If I needed to convert a string to a date object, but the dates weren't formatted the correct way, how would I do that?
For example, if I needed to convert '3/10/18'
or '11/7/18'
to a date so I could append it to a new array, what method should I use?
I tried datetime.strptime(string, '%m/%d/%Y')
, but since the month or date isn't always 2 digits in the string, it won't convert it.