title: Python Scientific Notation precision normalizing
body: <p>My goal is simply to convert a string such as "1.2" to scientific notation without adding additional precision.  The problem is that I always end up with superfluous 0s at the end of my output.</p>
  
  <pre><code>&gt;&gt;&gt; input = "1.2"
  &gt;&gt;&gt; print '{:e}'.format(float(input))
  1.200000e+00
  </code></pre>
  
  <p>I'm trying to figure out how to get just <code>1.2e+00</code>.  I realize I can specify precision in my format statement, but I don't want to truncate longer strings unnecessarily.  I just want to suppress the training 0s.</p>
  
  <p>I've tried using Decimal.normalize(), which works in all cases, except where e &lt; 2.</p>
  
  <pre><code>&gt;&gt;&gt; print Decimal("1.2000e+4").normalize()
  1.2E+4
  &gt;&gt;&gt; print Decimal("1.2000e+1").normalize()
  12
  </code></pre>
  
  <p>So that's better, except I don't want 12, I want 1.2e+1. :P</p>
  
  <p>Any suggestions would be greatly appreciated!</p>
  
  <p><strong>Edit:</strong>
  To clarify, the input value has already been rounded appropriately to a predetermined length that is now unknown.  I'm trying to avoid recalculating the appropriate formatting precision.  </p>
  
  <p>Basically, I could have input values of "1.23" and "1234.56", which should come out as "1.23e+0" and "1.23456e+3".</p>
  
  <p>I may have to just check how long the input string is and use that to specify a precision manually, but I wanted to check and make sure I just wasn't missing something that could just prevent the exponential format from arbitrarily adding 0s.</p>