3 number and dot..

Paul McNett p at ulmcnett.com
Wed Oct 31 16:18:59 EDT 2007


Abandoned wrote:

> Hi..
> I want to do this:
> for examle:
> 12332321 ==> 12.332.321
> 
> How can i do?


Assuming that the dots are always in the 3rd and 7th position in the string:

def conv(s, sep="."):
   l = [s[0:3], s[3:6], s[6:]]
   return sep.join(l)

print conv("12332321")


-- 
pkm ~ http://paulmcnett.com



More information about the Python-list mailing list