Home > Software engineering >  pycountry | extract values or convert Country object to iterable
pycountry | extract values or convert Country object to iterable

Time:03-14

How can I extract values in Country object or convert to an iterable?

Maybe specicially this isn't possible.

Goal: lookup a country code using alpha_2 param and extract all values.


Usage

pip install pycountry
import pycountry

pycountry.countries.get(alpha_2='DE')
>>> Country(alpha_2='DE', alpha_3='DEU', flag='           
  • Related