time data ' 25-11-2021 13:15:08' does not match format '%d-%m-%Y %H:%M:%S'

Viewed 29

I am facing a very weird issue with time data in python. I am using selenium to extract a datetime from a webpage. The variable exch_rec_date gets a value like this 25-11-2021 13:15:08. Now I need only date from it to compare it further down the code.

exch_rec_date = table_data.find_element(By.XPATH, '//*@id="lblann"]/table/tbody/tr[4]/td/table[1]/tbody/tr[2]/td/b[1]').get_attribute("innerHTML")
print(exch_rec_date)
exch_rec_date_modified = datetime.strptime(exch_rec_date, '%d-%m-%Y %H:%M:%S').date()

But it triggers an error like this: time data ' 25-11-2021 13:15:08' does not match format '%d-%m-%Y %H:%M:%S'

format looks matching to me. Can you figure out what's going on here?

Thanks in advance

0 Answers
Related