Reputation: 876
There is a way, using locale
on python to get the currency of a specific country or having the currency code, knows which countries that official use this currency?
Upvotes: 2
Views: 2443
Reputation: 136409
It might be possible for you to use my mpu
package:
import mpu
ger_currency = mpu.units.get_currency('GERMANY')
eur_currency = mpu.units.get_currency('EUR')
Now you have a mpu.units.Currency object:
>>> ger_currency.__dict__
{'code': 'EUR',
'exponent': 2,
'symbol': '\xe2\x82\xac',
'withdrawal_date': None,
'numeric_code': '978',
'entities': ['GERMANY'],
'subunits': '',
'name': 'Euro'}
By now, the entities
entry is just the current entity.
Upvotes: 2
Reputation: 476
import locale
locale.setlocale(locale.LC_ALL, 'en_US')
db = locale.localeconv()
db
is a dict()
containing a bunch of keys, one of which (int_curr_symbol
) is the currency symbol for the locale.
Dump it or see the locale
documentation for more.
Upvotes: 1