Quick help needed: how to format an integer ?

durumdara at mailpont.hu durumdara at mailpont.hu
Wed Oct 5 05:55:08 EDT 2005


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) ?

Thanx for it: dd

Ps:
Now I use this proc:

def toths(i):
    s=str(i)
    l=[]
    ls=len(s)
    for i in range(ls):
        c=s[ls-i-1]
        if i%3==0 and i<>0:
           c=c+"."
        l.append(c)
    l.reverse()
    return "".join(l)






More information about the Python-list mailing list