Created
October 5, 2022 06:31
-
-
Save AmanAdastra/086509ed52101dc45fc4c2f99e5dbdb6 to your computer and use it in GitHub Desktop.
How to list all country names with country code or dialing code in Python?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import phonenumbers | |
import pycountry | |
dct = {country.name: phonenumbers.country_code_for_region(country.alpha_2) for country in pycountry.countries} | |
print(dct) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment