Formate a number with commas

noydb jenn.duerr at
Thu Feb 9 21:08:41 CET 2012

How do you format a number to print with commas?

Some quick searching, i came up with:

>>> import locale
>>> locale.setlocale(locale.LC_ALL, "")
>>> locale.format('%d', 2348721, True)

I'm a perpetual novice, so just looking for better, slicker, more
proper, pythonic ways to do this.


More information about the Python-list mailing list