how to improve this simple block of code
Ron Griswold
RGriswold at Rioting.com
Wed Jan 11 16:14:11 EST 2006
How 'bout:
X = "132.00";
Y = int(float(X));
Ron Griswold
Character TD
R!OT Pictures
rgriswold at rioting.com
-----Original Message-----
From: python-list-bounces+rgriswold=rioting.com at python.org
[mailto:python-list-bounces+rgriswold=rioting.com at python.org] On Behalf
Of Mel Wilson
Sent: Wednesday, January 11, 2006 1:08 PM
To: python-list at python.org
Subject: Re: how to improve this simple block of code
py wrote:
> Say I have...
> x = "132.00"
>
> but I'd like to display it to be "132" ...dropping the trailing
> zeros...
print '%g' % (float(x),)
might work.
Mel.
--
http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list