how to improve this simple block of code

Tim Williams (gmail) tdwdotnet at gmail.com
Wed Jan 11 10:23:50 EST 2006


On 11/01/06, Mike Meyer <mwm at mired.org> wrote:
>
> "py" <codecraig at gmail.com> writes:
> > Say I have...
> > x = "132.00"
> > but I'd like to display it to be "132" ...dropping the trailing
> > zeros...I currently try this


Is it likely that  x might not have any decimal places?    If so all the
above solutions fail when x =130 except Matt Hammond's offering which splits
x at the decimal point if one exists.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060111/370bd86d/attachment.html>


More information about the Python-list mailing list