Trying to convert a string to datetime:
from datetime import datetime
date_string = "2021-07-07T02:27:00Z"
datetime.strptime('2021-07-07T02:27:00Z', '%Y-%M-%d %H:%M:%S')
Error:
error: redefinition of group name 'M' as group 5; was group 2 at position 107
Any then I tried:
datetime.fromisoformat(date_string)
Still not working.
Any friend can help?