Formatting numbers

Mike C. Fletcher mcfletch at home.com
Tue May 1 19:44:36 EDT 2001


>>> value = 12345
>>> whole = value/100
>>> frac = value-(whole*100)
>>> print '%i.%i'%( whole, frac)
123.45

HTH,
Mike

-----Original Message-----
From: Daniel Klein [mailto:DanielK at jBASE.com]
Sent: Tuesday, May 01, 2001 19:14
To: python-list at python.org
Subject: Formatting numbers


This is almost embarrasing to have to ask this but I can't seem to find this
information.

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

Thanks,
Dan Klein




--
http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list