Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def read_records_from_file(filename):
- """takes a file name and returns the list of records in the file"""
- result = []
- reader = False
- done = False
- with open(filename, 'r') as f_filename:
- while not done:
- line = f_filename.readline()
- if line:
- if reader:
- result.append(line[:-1])
- if line == '<begin count data>\n':
- reader = True
- elif line == '<end count data>\n':
- reader = False
- else:
- done = True
- return result[:-1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement