title: convert string to datetime object
body: <p>I'd like to convert this string into a datetime object:</p>
  
  <pre><code>Wed Oct 20 16:35:44 +0000 2010
  </code></pre>
  
  <p>Is there a simple way to do this?  Or do I have to write a RE to parse the elements, convert Oct to 10 and so forth?</p>
  
  <p>EDIT:
  strptime is great.  However, with</p>
  
  <pre><code>datetime.strptime(date_str, "%a %b %d %H:%M:%S %z %Y")
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>ValueError: 'z' is a bad directive in format '%a %b %d %H:%M:%S %z %Y'
  </code></pre>
  
  <p>even though %z seems to be correct.</p>
  
  <p>EDIT2:
  The %z tag appears to not be supported.  See <a href="http://bugs.python.org/issue6641" rel="noreferrer">http://bugs.python.org/issue6641</a>.
  I got around it by using a timedelta object to modify the time appropriately.</p>