0

I am converting date strings to datetime objects for comparison using datetime.strptime('00:01:47.210', '%H:%M:%S.%f'). Now the problem is that I encountered a datetime string which did not have milliseconds 0:01:53, and I got an error saying ValueError: time data '0:01:53' does not match format '%H:%M:%S.%f'. How do I handle multiple datetime string formats? Specifically, how do I convert datetime strings with and without missing milliseconds.

Aditya
  • 906
  • 9
  • 29

0 Answers0