3 number and dot..

Paul McGuire ptmcg at austin.rr.com
Wed Oct 31 16:38:08 EDT 2007


On Oct 31, 2:58 pm, Abandoned <best... at gmail.com> wrote:
> Hi..
> I want to do this:
> for examle:
> 12332321 ==> 12.332.321
>
> How can i do?

>>> x = (12332321,)
>>> while (x[0]>0): x=divmod(x[0],1000)+x[1:]
...
>>> x
(0, 12, 332, 321)
>>> ".".join(map(str,x[1:]))
'12.332.321'

-- Paul




More information about the Python-list mailing list