How to open a .txt file, analyze each individual date, determine how many time a day of the week appeared, in Python? <p>I am working on a project that I was able to do manually by hand, but am troubled when trying to write it in Python. I'm a new programmer in college.</p> <p>I have a .txt file that looks like so (for the sake of space I will only paste a bit, but there is 134 rows, not including the Date, Event #, Time, etc.)</p> <pre><code>Date Event # TIME Victim Name V R/G V Age 150101 0685 2:03 Anderson, Kedral BM 26 150103 0816 5:57 Shines, Kathryn WF 54 150106 4417 22:06 Norton, Noella HF 46 150107 4655 23:27 Speidel, Steven WM 41 150110 1100 8:35 Orozco, Jose HM 53 140813 2059 14:53 Liu, Kim Chunng AF 74 </code></pre> <p>I then need to collect the data, analyze it, and determine:</p> <ul> <li><p>The day of the week each homicide occurred on.</p></li> <li><p>A count of the number of homicides that occurred on each day of the week.</p></li> <li><p>A count of the number of homicides that fall within each hour block of the 24 hour time clock.</p></li> <li><p>A percentage of each racial/gender category for the 2015 homicides.</p></li> <li><p>A count of the number of homicide victims falling in each age category (0-10,11-20,21-30,31-40,41-50,51-60, etc.)</p></li> <li><p>Then take that data and put it in to a series of plots which I have the code for and know how to do.</p></li> </ul> <p>Here is the help I need:</p> <ol> <li><p>I need help with taking each "150101" and using Zeller's congruence to determine the date and put them in a list I believe.</p></li> <li><p>I have a very good idea of what I need to do, I just don't know how exactly to go about it</p></li> </ol> <p>Here is what I have so far:</p> <pre><code>fd = open("2015HomicideLog.txt",'r') bd = {} skipline = fd.readline() for line in fd: bd.append(line.split()[0] </code></pre> <p>Here is my code for zellers:</p> <pre><code>def zeller(day, month, year): if month == 1: A = 11 year = year - 1 elif month == 2: A = 12 year = year - 1 elif month == 3: A = 1 year = year elif month == 4: A = 2 year = year elif month == 5: A = 3 year = year elif month == 6: A = 4 year = year elif month == 7: A = 5 year = year elif month == 8: A = 6 year = year elif month == 9: A = 7 year = year elif month == 10: A = 8 year = year elif month == 11: A = 9 year = year elif month == 12: A = 10 year = year yearlist = list(str(year)) twodigityear = yearlist[2] + yearlist[3] twodigitcentury = yearlist[0] + yearlist[1] B = day C = int(twodigityear) D = int(twodigitcentury) W = (13 * int(A) - 1) / 5 X = int(C) / 4 Y = int(D) / 4 Z = int(W) + int(X) + int(Y) + int(B) + int(C) - (2 * int(D)) R = Z % 7 if R == 0: print("Sunday") elif R == 1: print("Monday") elif R == 2: print("Tuesday") elif R == 3: print("Wednesday") elif R == 4: print("Thursday") elif R == 5: print("Friday") elif R == 6: print("Saturday") </code></pre>