How to convert country names to ISO 3166-1 alpha-2 values, using python

后端 未结 7 1138
醉酒成梦
醉酒成梦 2020-12-13 13:25

I have a list of countries like:

countries=[\'American Samoa\', \'Canada\', \'France\'...]

I want to convert them like this:



        
7条回答
  •  眼角桃花
    2020-12-13 14:06

    For those using the ISO 3166-1 Country Codes, they will no longer be freely availalble from ISO after Feb. 20, 2014. See their notice: http://www.iso.org/iso/home/standards/country_codes/country-codes_new-product-info

    There are plenty of archived versions on the net. I've placed copies (2/15/2014) of the English and French txt and xml versions here: http://www.opengeocode.org/archive.php

提交回复
热议问题