today = datetime.strptime('Sep 3 2021 2:58 pm', '%b %d %Y %I:%M %p')
Returns the following error: time data Sep 03 2021 2:58 pm
does not match format %b %d %Y %I:%M %p
today = datetime.strptime('Sep 3 2021 2:58 pm', '%b %d %Y %I:%M %p')
Returns the following error: time data Sep 03 2021 2:58 pm
does not match format %b %d %Y %I:%M %p
When I run it, it works fine. Perhaps you can try the following:
today = datetime.strptime('Sep 3 2021 2:58 pm', '%b %-d %Y %I:%M %p')
%-d
should be used if the day number is not zero-padded (i.e. Sep 3 instead of Sep 03). According to this website this is platform-specific, so perhaps you are using a platform that requires you to specify it is not zero-padded.