title: Convert a string to integer with decimal in Python
body: <p>I have a string in the format: 'nn.nnnnn' in Python, and I'd like to convert it to an integer.</p>
  
  <p>Direct conversion fails:</p>
  
  <pre><code>&gt;&gt;&gt; s = '23.45678'
  &gt;&gt;&gt; i = int(s)
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ValueError: invalid literal for int() with base 10: '23.45678'
  </code></pre>
  
  <p>I can convert it to a decimal by using:</p>
  
  <pre><code>&gt;&gt;&gt; from decimal import *
  &gt;&gt;&gt; d = Decimal(s)
  &gt;&gt;&gt; print d
  23.45678
  </code></pre>
  
  <p>I could also split on '.', then subtract the decimal from zero, then add that to the whole number ... yuck.</p>
  
  <p>But I'd prefer to have it as an int, without unnecessary type conversions or maneuvering.</p>