title: Convert '6E+007' into Decimal
body: <p>I have a python function that checks if the value passed is a valid number. The values passed are in string format.</p>
  
  <pre><code>def is_valid_numeral(text_to_check):
      '''Check if passed value is a valid numeral figure'''
      try: 
          float(text_to_check)
          return True
      except ValueError:
          return False
  </code></pre>
  
  <p>A value like <code>6E+007</code> is passed and this function returns True which is correct.</p>
  
  <p>After the above function, I need to save the passed figure into a Decimal field. So I run a <code>format_decimal</code> function as below</p>
  
  <pre><code>def format_decimal(value, decimals): 
      '''Format a value to "n" decimal places
      http://mkaz.com/solog/python/python-string-format.html
      '''
      try:
          if decimals == 2:
              value =  int(value)/100
              return "{:.2f}".format(int(value))
      except ValueError:
          raise 
  </code></pre>
  
  <p>At this point, it fails with the error:</p>
  
  <pre><code>`Value Error: Invalid literal for int() with base 10:6E+007`
  </code></pre>
  
  <p>Since this really is a valid figure just in a different notation, is there a function that can convert this type of value for me and then pass it through the <code>format_decimal</code> function?</p>