D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Python printing

 

Neil Winchurst wrote:
> I expect it is quite simple, but I cannot find anything to help me.
> 
> Are there any Python experts out there? There must be a way to print
> long numbers as for example 1,234,567 instead if 1234567. I just can't
> find out how to do this. Or is this beyond the capabilities of Python?
> That would surprise me.

I'm a perl guy, not a python one - but in most cases you need to stop 
thinking of that as a number and start thinking of it as a string. That 
way you can add commas at strlen-3 in increments of 3.

That said, almost certainly something in PEAR that does it.

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html