justcode.ikeepstudying.com
PHP数组,Python:世界各国简称,国家语言,人口,位置, List of all countries in different formats (ISO, tld, capital, language, population) - Just Code
Python: generator.py import codecs import urllib import requests import csv import json mapping = [ 'alpha_2', 'alpha_3', 'numeric', 'fips', 'name', 'capital', 'area', 'population', 'continent', 'tld', 'currency_code', 'currency_name', 'phone', 'postal_code_format', 'postal_code_regex', 'languages', 'geoname_id', 'neighbours', 'eqivalent_fips_code', ] countries = [] url = "http://sources.ikeepstudying.com/list-of-countries/countryInfo.txt" stream = urllib.request.urlopen(url) reader = codecs.getreader("utf-8") reader = csv.reader(reader(stream), delimiter='\t') non_comment_rows = [row …