title: Converting string with UTC offset to a datetime object
body: <p>Given this string: <code>"Fri, 09 Apr 2010 14:10:50 +0000"</code> how does one convert it to a <code>datetime</code> object?</p>
  
  <p>After doing some reading I feel like this should work, but it doesn't...</p>
  
  <pre><code>&gt;&gt;&gt; from datetime import datetime
  &gt;&gt;&gt;
  &gt;&gt;&gt; str = 'Fri, 09 Apr 2010 14:10:50 +0000'
  &gt;&gt;&gt; fmt = '%a, %d %b %Y %H:%M:%S %z'
  &gt;&gt;&gt; datetime.strptime(str, fmt)
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/lib64/python2.6/_strptime.py", line 317, in _strptime
      (bad_directive, format))
  ValueError: 'z' is a bad directive in format '%a, %d %b %Y %H:%M:%S %z'
  </code></pre>
  
  <p>It should be noted that this works without a problem:</p>
  
  <pre><code>&gt;&gt;&gt; from datetime import datetime
  &gt;&gt;&gt;
  &gt;&gt;&gt; str = 'Fri, 09 Apr 2010 14:10:50'
  &gt;&gt;&gt; fmt = '%a, %d %b %Y %H:%M:%S'
  &gt;&gt;&gt; datetime.strptime(str, fmt)
  datetime.datetime(2010, 4, 9, 14, 10, 50)
  </code></pre>
  
  <p>But I'm stuck with <code>"Fri, 09 Apr 2010 14:10:50 +0000"</code>. I would prefer to convert exactly that without changing (or slicing) it in any way.</p>