An API is providing a time stamp in the following format
s = "2023-02-02T21:05:07.2207121Z"`
I'm attempting to convert it to a datetime object
dt = datetime.strptime(s, "%Y-%m-%dT%H:%M:%S.%fZ")
It's causing the following error
line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '2023-02-02T21:05:07.2207121Z' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'
This question was marked as a duplicated linked to a post suggesting fromisoformat(s)
, but that fails as well
dt = datetime.fromisoformat(s)
error
dt = datetime.fromisoformat(s)
ValueError: Invalid isoformat string: '2023-02-02T21:05:07.2207121Z'