Alex Rivera | Logout

Python - Convert currency code to its sign

Asked 2010-12-19T13:36:48.283
22

In Python, how can I convert currency code to its sign?

For example, USD would be converted to $, and JPY would be converted to ¥.

If there isn't a generic way to do this, is there any simple dictionary of these on the Web?

Thanks.

Edit
Report

1 Answer

20

How about Babel?

from babel import numbers
print numbers.get_currency_symbol('USD', locale='en') # => $1,500.00
print numbers.get_currency_symbol('GBP', locale='fr_FR') # => 1 500,00 £UK
answered 2013-06-03T08:36:10.083

Your Answer