Skip to content

Instantly share code, notes, and snippets.

@AmanAdastra
Created October 5, 2022 06:31
Show Gist options
  • Save AmanAdastra/086509ed52101dc45fc4c2f99e5dbdb6 to your computer and use it in GitHub Desktop.
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?
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