https://github.com/ranjan2104/fetch-data-of-any-country
search to help people discover “proper” countries for names that might only actually be subdivisions. The fuzziness also includes normalizing unicode accents. There’s also a bit of prioritization included to prefer matches on country names before subdivision names and have countries with more matches be listed before ones with fewer matches:
https://github.com/ranjan2104/fetch-data-of-any-country
countryinfo python3
Last synced: 4 months ago
JSON representation
search to help people discover “proper” countries for names that might only actually be subdivisions. The fuzziness also includes normalizing unicode accents. There’s also a bit of prioritization included to prefer matches on country names before subdivision names and have countries with more matches be listed before ones with fewer matches:
- Host: GitHub
- URL: https://github.com/ranjan2104/fetch-data-of-any-country
- Owner: Ranjan2104
- License: gpl-3.0
- Created: 2021-06-01T05:10:37.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-06-01T05:16:53.000Z (about 4 years ago)
- Last Synced: 2025-01-08T16:31:19.771Z (5 months ago)
- Topics: countryinfo, python3
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fetch Data of Any Country
search to help people discover “proper” countries for names that might only actually be subdivisions. The fuzziness also includes normalizing unicode accents. There’s also a bit of prioritization included to prefer matches on country names before subdivision names and have countries with more matches be listed before ones with fewer matches:>>> import pycountry
>>> len(pycountry.countries)
249
>>> list(pycountry.countries)[0]
Country(alpha_2='AF', alpha_3='AFG', name='Afghanistan', numeric='004', official_name='Islamic Republic of Afghanistan')
>>> germany = pycountry.countries.get(alpha_2='DE')
>>> germany
Country(alpha_2='DE', alpha_3='DEU', name='Germany', numeric='276', official_name='Federal Republic of Germany')
>>> germany.alpha_2
'DE'