Quick help needed: how to format an integer ?

Diez B. Roggisch deets at nospam.web.de
Wed Oct 5 06:37:50 EDT 2005


durumdara at mailpont.hu wrote:
> Hi !
> 
> I need to convert some integer values.
> 
> "1622" ->"1 622"
> 
> or
> 
> "10001234" -> ""10.001.234""
> 
> So I need thousand separators.
> 
> Can anyone helps me with a simply solution (like %xxx) ?

The module locale does what you need, look at ist docs, especially


locale.str
locale.format


Regards,

Diez



More information about the Python-list mailing list