how to improve this simple block of code

Gary Duzan gary.duzan at
Wed Jan 11 11:25:35 EST 2006

py wrote:
> x = "132.15"  ...i dont want to modify it.  But if
> x = "132.60" ...I want it to become "132.6"
> is there a better way to do this?  It seems a bit ugly to me.

    The following works as long as you don't mind losing leading zeros 
as well:

x = x.strip('0')

					Gary Duzan
					Motorola CHS

More information about the Python-list mailing list