A.M wrote:
> Is there any built in feature in Python that can format long integer
> 123456789 to 12,3456,789 ?

The locale module can help you here:

  >>> import locale
  >>> locale.setlocale(locale.LC_ALL, '')
  'English_United States.1252'
  >>> locale.format('%d', 123456789, True)
  '123,456,789'

Be sure to read the caveats for setlocale in the module docs:
  http://docs.python.org/lib/node323.html
I'd recommend calling setlocale only once, and always at the start of
your program.

--Ben

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to