In Python 3.10.8, if I write
from datetime import datetime
print(datetime.fromisoformat('2011-11-04T00:05:23Z'))
I get the error
Traceback (most recent call last):
File "main.py", line 2, in <module>
print(datetime.fromisoformat('2011-11-04T00:05:23Z'))
ValueError: Invalid isoformat string: '2011-11-04T00:05:23Z'
This is surprising, since this example is taken directly out of the datetime
module documentation:
>>> from datetime import datetime
# ...
>>> datetime.fromisoformat('2011-11-04T00:05:23Z')
datetime.datetime(2011, 11, 4, 0, 5, 23, tzinfo=datetime.timezone.utc)
Is this a bug or an error in the documentation?