title: Python: Convert Dictionary of String Times to Date Times
body: <p>I have a dictionary <code>alerts[]</code> which includes the key <code>alert_date</code>. All dates/times are stored as strings. I am displaying the date in Django, but templates can't format time stored as a sting. So, I want to convert it in my view as such: </p>
  
  <pre><code>foo = "2014-10-07 00:00:00"
  bar = datetime.strptime(foo, "%Y-%m-%d %H:%M:%S")
  </code></pre>
  
  <p>But, I want to convert all the dictionary time values at once. I'm grabbing the dictionary as JSON through an API call. I want to do something like this (which is obviously invalid code):</p>
  
  <pre><code>alerts = resp_data['alerts']
  for v in alerts['alert_date']:
      v = datetime.strptime(v, "%Y-%m-%d %H:%M:%S")
  </code></pre>
  
  <p>//EDIT:
  The JSON response is a dictionary which contains <code>alerts</code>, which is a list of dictionaries as follows:</p>
  
  <pre><code>{"alerts": [
      {
        "key1": "value11",
        "key2": "value12",
        "key3": "value13",
        "alert_date": "2014-06-05 01:00:23.633000",
      },
      {
        "key1": "value21",
        "key2": "value22",
        "key3": "value23",
        "alert_date": "2010-12-31 00:00:00",
      }
  ]}
  </code></pre>