Write floating point numbers without any decimal places
<p>I'm trying to have Python replicate some FORTRAN output of real values. My FORTRAN prints the real value as "31380.". I'm trying to replicate the same in Python--note that although I have no decimal places, I actually want the decimal point (period) to be printed. My current code is</p>

<pre><code>htgm=31380.
print '{:6.0f}'.format(htgm)
</code></pre>

<p>which yields "31380". What am I doing wrong?</p>

<p>When you need to display the number, use:</p>

<pre><code>print(str(htgm)[:-1])
</code></pre>

<p>This notation will shave off the last '0'.</p>

python string format