I have a list of dates, written as strings, called depart_date
depart_date = ['3/1/2012', '3/4/2012', '3/11/2012']
etc.
I'd like to convert them to date objects. This is what I have:
for i in depart_date:
dep_date = datetime.strptime(depart_date[i], '%m/%d/%Y')
and it gives me the TypeError: list indices must be integers, not str. I'm not sure why I'm getting this error because I thought the strptime function was supposed to convert strings into date objects.
Any help??
You need to add
.Length
Alternative: