title: Convert list items to defined data type
body: <p>I'm rather new to python and I'm not sure how to do the following. </p>
  
  <p>I have a list <code>foo</code> containing metadata and measurement values for a certain plot. For example, a plotID, survey date, initials of surveyors, several measurement values and a categorical variable.</p>
  
  <pre><code>foo= ['plot001', '01-01-2013', 'XX', '10', '12.5', '0.65', 'A']
  </code></pre>
  
  <p>Because these data are read from a .txt, all list items are strings. My question is: <em>how do I convert each list item to the approporiate datatype?</em>. I can make a list with the desired data types:</p>
  
  <pre><code>dType= ['str', 'str', 'str', 'int', 'float', 'float', 'float', 'str']
  </code></pre>
  
  <p>It would be nice if I could apply each item in <code>dType</code> as function to the matching element in <code>foo</code> as such: </p>
  
  <pre><code>out= [str(foo[0]), str(foo[1]), str(foo[2]), int(foo[3]), float(foo[4]), float(foo[5]), float(foo[6]), str(foo[7])]
  </code></pre>
  
  <p>but I'm sure there must be a better solution! Thanks for any suggestions!</p>