Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Python floats

Name: Anonymous 2007-02-28 8:06 ID:hNUN74R6

Hey /g/, how do I display a float without ".0" at the end when its value is an integer? Is there a string formatting thing to do this?

Name: Anonymous 2007-03-01 2:44 ID:1bc36AS5

To answer the OP's question, truncate or round the floating point value to an integer first. Then convert the integer to a string. Simple!

Except sometimes languages do the rounding or truncation implicitly. That gets in my hair, it does.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List