How to print an integer with commas; E.g., 3,056,789

Richard Bow donkan7 at yahoo.com
Wed Oct 16 07:29:56 EDT 2002


Given any integer n, how can I convert str(n) to a string with commas in 
the appropriate places? For example, if n is 3056789, I'd like to convert 
str(3056789) to "3,056,789", for better readability of output.

Thanks,

Richard Bow



More information about the Python-list mailing list