There are several modules out there:
-
import pycountry country = pycountry.countries.get(name='Norway') currency = pycountry.currencies.get(numeric=country.numeric) print currency.alpha_3 print currency.name
prints:
NOK Norwegian Krone
-
import moneyed country_name = 'France' for currency, data in moneyed.CURRENCIES.iteritems(): if country_name.upper() in data.countries: print currency break
prints
EUR
-
import money country_name = 'France' for currency, data in money.CURRENCY.iteritems(): if country_name.upper() in data.countries: print currency break
prints
EUR
pycountry
is regularly updated, py-moneyed
looks great and has more features than python-money
, plus python-money
is not maintained now.
Hope that helps.