On Oct 31, 7:58 pm, Abandoned <[EMAIL PROTECTED]> wrote: > Hi.. > I want to do this: > for examle: > 12332321 ==> 12.332.321 > > How can i do?
Short without being too unreadable: def conv(x, sep='.'): x = str(x)[::-1] return sep.join(x[i:i + 3] for i in range(0, len(x), 3))[::-1] Or more simple-mindedly... def conv(x, sep='.'): x, y = str(x), [] while x: y.append(x[-3:]) x = x[:-3] return sep.join(reversed(y)) -- Paul Hankin -- http://mail.python.org/mailman/listinfo/python-list