Hi Jiten

I have probably a easier way via an import.
here you go:

import locale

def number_format(number, grouping=0):
return locale.format("%.*f", (grouping, number), True)

regards,
Sri

On Sat, Mar 22, 2008 at 2:10 AM, Nanolets nanolets <[EMAIL PROTECTED]>
wrote:

> A stupid way to do this is
>
> x=123456789
> x=str(x)
> n=len(x)
> s=n%3
> outs=x[0:s]
> while ( s < n) :
>        outs = outs + "," + x[s:s+3]
>        s=s+3
> print outs
>
>
> On 3/19/08, Jiten Shah <[EMAIL PROTECTED]> wrote:
> >
> > Dear Friends,
> >
> > I am new for python and new for this mailing list also
> >
> > My problem is i want to print
> >    1156179 to ->   1,156,179.00
> >
> > Can somebody help me.
> >
> >
> > Jiten
> >
> >
> >
> >
> >
> >
> >       
> > ____________________________________________________________________________________
> > Be a better friend, newshound, and
> > know-it-all with Yahoo! Mobile.  Try it now.
> > http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> > _______________________________________________
> > BangPypers mailing list
> > BangPypers@python.org
> > http://mail.python.org/mailman/listinfo/bangpypers
> >
>
>
> _______________________________________________
> BangPypers mailing list
> BangPypers@python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
>
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to