Insert comma in number?

ian douglas iandouglas736 at gmail.com
Thu Mar 7 00:51:10 CET 2013


On 03/06/2013 03:39 PM, eli m wrote:
> I have a python program that accepts input and calculates the factorial of that number, and i want to know if i can make it so commas get inserted in the number.
> For example: instead of 1000 it would say 1,000


pip install humanize


import humanize
my_integer = 12345678
commafied_integer = humanize.intcomma(my_integer)
print commafied_integer


output:
12,345,678



More information about the Python-list mailing list