title: Convert iso format datetime string to datetime object in Python
body: <p>I am facing a issue while converting a iso format datetime string to datetime object in Python 3.6 without loosing the timezone info.
  The string is like this.</p>
  <pre><code>2021-07-04T00:00:00+02:00
  </code></pre>
  <p>I tried datetime.datetime.strptime method. But unable to set the correct format string.</p>
  <pre><code>datetime.datetime.strptime( &quot;2021-07-04T00:00:00+02:00&quot;, &quot;%Y-%m-%dT%H:%M:%S%z&quot;)
  </code></pre>
  <p>If the datetime string is in this format it works:</p>
  <pre><code>datetime.strptime(&quot;2021-07-04T00:00:00+0200&quot;, &quot;%Y-%m-%dT%H:%M:%S%z&quot;)
  </code></pre>
  <p>But in this format, don't work:</p>
  <pre><code>datetime.datetime.strptime( &quot;2021-07-04T00:00:00+02:00&quot;, &quot;%Y-%m-%dT%H:%M:%S%z&quot;)
  </code></pre>
  <p>And I have the datetime in this format:</p>
  <pre><code>2021-07-04T00:00:00+02:00
  </code></pre>