Remove integer from float number

Paul Rubin http
Thu Mar 23 14:51:25 EST 2006


"Derek Basch" <dbasch at yahoo.com> writes:
> Ahh yes you have to put parenthases around the string formatting to
> remove the integer using indexes. Thanks, that's just what I needed!

I think it's better to remove leading zeros explicitly:

    ('%.3x' % x).lstrip('0')



More information about the Python-list mailing list