insert thousands separators
gh at ghaering.de
Mon Jun 16 16:00:42 CEST 2003
Nick Vargish wrote:
> ps. Looking at the library reference, it's not clear if there's an easy
> way to extract the fractional portion of a float without hitting the
> Standard Floating Point Problem:
>>>>v = 2312.3123123
>>>>v1 = int(v)
>>>>v2 = v - v1
If you need that, then a float is probably not the right data type.
There are several implementations of arbitrary precision numbers out there.
Some more fun with floats:
>>> v - v1
>>> s = str(v)
So if you only want to print the fractional value, str() will do fine.
But str() won't make floats capable of representing arbitrary numbers,
More information about the Python-list