title: Scientific Notation formatting in Python
body: <p>How can get following formatting (input values are always less than 0.1):</p>
  
  <pre><code>&gt; formatting(0.09112346)
  0.91123E-01
  &gt; formatting(0.00112346)
  0.11234E-02
  </code></pre>
  
  <p>and so on.</p>
  
  <p>I am looking for some elegant solution. I am already using a custom function given below:</p>
  
  <pre><code>def formatting(x, prec=5):
      tup    = x.as_tuple()
      digits = list(tup.digits[:prec])
      dec    = ''.join(str(i) for i in digits)
      exp    = x.adjusted()
      return '0.{dec}E{exp}'.format(dec=dec, exp=exp)
  </code></pre>