def read_data(data):
with open("in.dat", "r") as f:
data = f.readlines()
return data
# Takes a list of lines as input and returns a new list of lines with the
# comment lines (the ones that begin with #) removed.
def remove_comment_lines(data):
with open("in.dat", "w") as f:
for line in data:
if line.startswith('#'): continue
f.write(line)
# read file as list of lines and save to variable
data = read_data("in.dat")
# pass data to remove comment function
remove_comment_lines(data)
#
#
09.30AM:09.45AM:220
11.45AM:12.23PM:300
11.45AM:10.23AM:302
2.45PM:3.23PM:202
3.45PM:3.53PM:90
5.45PM:5.53PM:80
6.45PM:7.23PM:1000
10.45PM:10.53PM:102