Insert comma in number?

Chris Rebert clp2 at rebertia.com
Thu Mar 7 01:07:11 CET 2013


On Wed, Mar 6, 2013 at 3:39 PM, eli m <techgeek201 at gmail.com> 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

Use the "," (i.e. comma) format() specifier directive. See
http://docs.python.org/2/library/string.html#format-specification-mini-language
See also: http://www.python.org/dev/peps/pep-0378/

Cheers,
Chris



More information about the Python-list mailing list