On Sat, 15 Feb 2014 14:34:45 -0700, Ian Kelly wrote:
> On Sat, Feb 15, 2014 at 11:57 AM, Luke Geelen <luke.geelen at gmail.com>
>> hey, is it possible to remove the .0 if it is a valua without something
>> behind the poit (like 5.0 gets 5 but 9.9 stays 9.9
> The ':g' format specifier will trim off trailing zeroes, e.g.:
Oh! That's much nicer than my solution. And it even works with %-style
string interpolation too!
py> "%g" % 23.0
py> "%g" % 23.1
Even though I didn't ask the question, I learned something from the
answer. Thank you.