Formate a number with commas
Neil Cerutti
neilc at norwich.edu
Thu Feb 9 15:17:38 EST 2012
More information about the Python-list mailing list
Thu Feb 9 15:17:38 EST 2012
- Previous message (by thread): Formate a number with commas
- Next message (by thread): Formate a number with commas
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2012-02-09, noydb <jenn.duerr at gmail.com> wrote: > 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) > '2,348,721' > > I'm a perpetual novice, so just looking for better, slicker, > more proper, pythonic ways to do this. I think you've found an excellent way to do it. -- Neil Cerutti
- Previous message (by thread): Formate a number with commas
- Next message (by thread): Formate a number with commas
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list