3 number and dot..

Paul Rubin http
Wed Oct 31 21:21:56 EDT 2007


Abandoned <besturk at gmail.com> writes:
> 12332321 ==> 12.332.321

Untested:

def convert(n):
   assert type(n) in (int,long)
   if n < 0: return '-%s'% convert(-n)
   if n < 1000: return str(n)
   return '%s.%03d' % (convert(n//1000), n % 1000)



More information about the Python-list mailing list