Couple functions I need, assuming they exist?
Charles Krug
cdkrug at worldnet.att.net
Mon Jun 20 13:17:18 EDT 2005
On 20 Jun 2005 15:51:07 GMT, Duncan Booth <duncan.booth at invalid.invalid> wrote:
> Peter Hansen wrote:
>
>>> The target of the problems (my daughter) would prefer that the thousands
>>> be delimited. Is there a string function that does this?
>>
>> You refer to something like putting a comma between groups of three
>> digits, as in 1,000? This is locale-specific, and there's a "locale"
>> module that should have what you need.
>
>>>> import locale
>>>> locale.setlocale(locale.LC_ALL, '')
> 'English_United Kingdom.1252'
>>>> print locale.format("%d", 1000000, True)
> 1,000,000
Perfect!
Thanks.
Sometimes "hard part" is figuring out which package already does the
thing I need done.
Charles.
More information about the Python-list
mailing list