Screen Link:
https://app.dataquest.io/m/353/working-with-dates-and-times-in-python/5/using-strptime-to-parse-strings-as-dates
My Code:
import datetime as dt
#print(potus[0:])
#Start_date=0
date_format='%m/%d/%y %H:%M'
for row in potus[0:4]:
appt_start_date=row[2]
print(appt_start_date)
Start_date=dt.datetime.strptime(appt_start_date,date_format)
print(Start_date)
row[2]=Start_date
print(row[2])
print(potus[0:3])
What I expected to happen:
I was hoping this code updates all the row[2] values in potus list with updated date format.
What actually happened:
when the potus list is updated it at row[2] it shows output as datetime.datetime(2015, 1, 6, 9, 30) instead of 2015-01-06 09:30:00.
When I tried to debug, and added print messages at every line, while the code executes, the variables looks right. However in the end when it updates the potus list, and when I print Potus list, it doesn’t get updated correctly.
Replace this line with the output/error