我正在尝试将我的数据中的国家与蟒蛇内置的pycountry包匹配。运行后我收到此错误
raise AttributeError
AttributeError的
countries_lookup = {}
countries = list(pycountry.countries)
for country in countries:
countries_lookup[country.alpha2]=country.name
country_names = list(countries_lookup.values())
country_names = [country.lower() for country in country_names]
country_names = set(country_names)
应该是什么问题?
答案 0 :(得分:1)
只是一个错误的纠正:
countries_lookup[country.alpha_2]=country.name
#-----------------------------^