Formatting numbers

rainy sill at localhost.debian.org
Tue May 1 19:49:27 EDT 2001


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

>>> i = 12345
>>> print str(i)[:3] + '.' + str(i)[3:]
123.45

>
>
>
>


-- 

	Andrei



More information about the Python-list mailing list