3 number and dot..

Abandoned besturk at gmail.com
Wed Oct 31 17:03:59 EDT 2007


On Oct 31, 10:38 pm, Paul McGuire <pt... at austin.rr.com> wrote:
> 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

Hmm.
When the number as 1023 the result is 1.23 :(
How can i fix it ?




More information about the Python-list mailing list