Write a Python 3 program tlparser.py to parse the five given timelog data files to get how many hours and minutes the author spent in each file. The timelog file name will be an argument for your Python program. For example, you run your program on the spirit machine like “python3 timelogparser.py TimeLogCarbon.txt”
Your program needs to report the line number if there is something wrong in that line that your Python program cannot parse.
Your program start to count the time after it found the hard-coded “Time Log:” (case insensitive, there is a space between Time and Log).
The “pm” and “am” should be case insensitive, i.e., 9:10pm or 9:10PM or 9:10pM or 9:10Pm are all valid time value.
“9:10pm – 11:40pm” or “9:10pm-11:40pm” or “9:10pm -11:40pm” are all valid time periods, i.e., the spaces between “-” and the time value are not important.


0 comments