0

I get the following error:

met exception: time data '2021-12-29T12:51:59.397Z' does not match format '%Y-%m-%dT%H:%M:%S.%f%z'

This is the code I use.

datetime.strptime(host_timesstr, '%Y-%m-%dT%H:%M:%S.%f%z')
  • 1
    Which version of Python are you using? The ability of strptime to parse Z to UTC (aware datetime) was added only in Python 3.7 I think (see technical detail section in the datetime module docs). – FObersteiner Dec 29 '21 at 13:27
  • 1
    Now I use python3.6.8, the link is very useful, thanks for your help! – sunjiayang Dec 29 '21 at 13:33

0 Answers0