10 2 write a program to read through the mbox short txt and figure out the distribut 5187188

10.2 Write a program to read through the mbox-short.txt and figure out the distribution by hour of the day for each of the messages. You can pull the hour out from the 'From ' line by finding the time and then splitting the string a second time using a colon.

From stephen.marquard@uct.ac.za Sat Jan 5
09:14:16 2008

Once you have accumulated the counts for each hour, print out the counts, sorted by hour as shown below.
I have this much done
name = raw_input(“Enter file:”)
if len(name)
    #open file in read mode
handle = open(name,”r”)
    #read all contnets of file
text=handle.readlines()
     #close the file
handle.close
     #loop each line of text
   
for line in text:
    if not line.startswith('From'):continue     
    line=line.rstrip()
    #split the line into words
    words=line.split()
    #if length of words is more than 5, than index will be valid.
    if (len(words)>5):
        pieces=words[5]
        email=pieces.split(':')       
       
     
   
    else:continue

   

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now