title: dropping trailing '.0' from floats
body: <p>I'm looking for a  way to convert numbers to string format, dropping any redundant '.0' </p>
  
  <p>The input data is a mix of floats and strings. Desired output:</p>
  
  <p>0   --> '0'</p>
  
  <p>0.0 --> '0'</p>
  
  <p>0.1 --> '0.1'</p>
  
  <p>1.0 --> '1'</p>
  
  <p>I've come up with the following generator expression, but I wonder if there's a faster way:</p>
  
  <pre><code>(str(i).rstrip('.0') if i else '0' for i in lst)
  </code></pre>
  
  <p>The truth check is there to prevent 0 from becoming an empty string.</p>
  
  <p>EDIT: The more or less acceptable solution I have for now is this:</p>
  
  <pre><code>('%d'%i if i == int(i) else '%s'%i for i in lst)
  </code></pre>
  
  <p>It just seems strange that there is no elegant way to handle this (fairly straightforward) case in python.</p>