title: Python: convert datetime format
body: <p>I've a string in the following date/time format:</p>
  
  <blockquote>
    <p>2018-05-20T07:06:23.226</p>
  </blockquote>
  
  <p>I need to convert it to the following format:</p>
  
  <blockquote>
    <p>2018-05-20 06:23 AM</p>
  </blockquote>
  
  <p>I tried the following code, but I'm surely making some mistake here:</p>
  
  <pre><code>date = "2018-05-20T07:06:23.226"
  d = datetime.datetime.strptime('date', '%Y-%m-%dT%H:%M:%S.%f')
  new_date = d.strftime('%y-%m-%d %H:%M %p')
  </code></pre>
  
  <p>I always get the following error:</p>
  
  <blockquote>
    <p>ValueError: time data 'date' does not match format '%Y-%m-%dT%H:%M:%S.%f'</p>
  </blockquote>