[Tutor] Even More Converter!

Kent Johnson kent37 at tds.net
Sat Mar 22 19:19:19 CET 2008


Alan Gauld wrote:

> Bear in mind that the use of commas is very much a 
> local thing. In some parts of the world periods are used 
> and a comma indicates a decimal point so
> 
> 123,456
> 
> could be 123 thousand 456 or 123 point 456 depending 
> on where the reader is from.
> 
> If that is important you might need to investigate a locale specific 
> way of defining the seperator. 

In [7]: import locale
In [9]: locale.setlocale(locale.LC_ALL, '')
Out[9]: 'en_US.UTF-8'
In [10]: locale.localeconv()['thousands_sep']
Out[10]: ','

Kent


More information about the Tutor mailing list