title: Converting 2012-12-19 string to datetime object in Python
body: <p>I have the following working code:</p>
  
  <pre><code>import datetime
  
  d = "2012-12-19"                
  f = map(int,  d.split('-') )
  day = datetime.date( f[0], f[1], f[2] )
  
  print day
  </code></pre>
  
  <p>but when I try to write it this way:</p>
  
  <pre><code>day = datetime.date( f )
  </code></pre>
  
  <p>I get an exception:  TypeError: an integer is required</p>
  
  <p>Why is that and how could I write this better?</p>