How can I read a file and convert each line into a date?
Ok so I have a “holiday.txt” file that I intend to have Python read. In it, I want to have lines that say such things as:
11/24/11
11/25/11
12/25/11
12/31/11
1/1/12
5/28/12
7/4/12
9/3/12
etc. These are the holidays for my company. I want the program to read these, and convert them into date (?) objects, which can be modified by timedelta or compared to the dates that emails are going to be sent out. Basically I want to insure in my program that any dates listed here are not going to have emails sent on them (but that is something I will write, I just want to convert all dates to time objects)
You could use datetime.strptime to convert the strings into
datetime.datetimeobjects: