[Tutor] PyCountry currency formatting woes

Alan Gauld alan.gauld at btinternet.com
Mon May 5 02:16:17 CEST 2014


On 04/05/14 21:25, Sithembewena Lloyd Dube wrote:

> currency = pycountry.currencies.get(numeric=country.numeric)
>

Have you tried using locales?

import locale as loc
loc.setlocale(loc.LC_ALL,'')  # selects default - do this at start
...
print(loc.currency(myNum_here))

I don't know the module you reference but locale is the standard library 
option...

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list