擅长:python、mysql、java
<p>如果您可以使用<strong><a href="https://pypi.python.org/pypi/python-dateutil/2.6.1" rel="nofollow noreferrer">dateutil</a></strong>模块,您可以这样做。你知道吗</p>
<pre><code>from dateutil import parser
print parser.parse('2018-02-06T14:45:03.0040554Z')
</code></pre>
<p><strong>输出:</strong></p>
<pre><code>2018-02-06 14:45:03.004055+00:00
</code></pre>
<p>使用Datetime。看来你错过了秒参数,微秒必须是6,你有7。你知道吗</p>
<pre><code>import datetime
print datetime.datetime.strptime('2018-02-06T14:45:03.004055Z', '%Y-%m-%dT%H:%M:%S.%fZ')
print datetime.datetime.strptime('2018-02-06T14:45:03Z', '%Y-%m-%dT%H:%M:%SZ')
</code></pre>
<p><strong>输出</strong>:</p>
<pre><code>2018-02-06 14:45:03.004055
2018-02-06 14:45:03
</code></pre>