Open Knowledge Foundation(http://data.okfn.org/)网站里面有大量可以免费下载的资源。
import json
import pygal_maps_world.maps
from pygal.style import LightColorizedStyle as LCS, RotateStyle as RS
from pygal.maps.world import COUNTRIES
def get_country_code(country_name):
"""将指定国家的名字以2字母形式表达"""
for code, name in COUNTRIES.items():
if name == country_name:
return code
# 如果没有找到那个国家
return