This is the default string representation of a datetime:
>>> from datetime import datetime, timezone
>>> dt = datetime(2017, 1, 1, tzinfo=timezone.utc)
>>> print(dt)
2017-01-01 00:00:00+00:00
What is the correct format string to parse that with datetime.strptime
? That is, what format goes in place of the "???" to consistently have the following invariant:
>>> dt == datetime.strptime(str(dt), "???")
True