Formatting numbers

Matthew Dixon Cowles matt at mondoinfo.com
Tue May 1 19:52:56 EDT 2001


On Tue, 1 May 2001 16:13:30 -0700, Daniel Klein <DanielK at jBASE.com>
wrote:

>Given an integer, 12345, how to format this to 123.45 ?

Here's one way:

>>> 12345/100.0 
123.45

You need the ".0" or at least the dot in order to force floating-point
division.

Regards,
Matt



More information about the Python-list mailing list