Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. def read_records_from_file(filename):
  2. """takes a file name and returns the list of records in the file"""
  3. result = []
  4. reader = False
  5. done = False
  6. with open(filename, 'r') as f_filename:
  7. while not done:
  8. line = f_filename.readline()
  9. if line:
  10. if reader:
  11. result.append(line[:-1])
  12. if line == '<begin count data>\n':
  13. reader = True
  14. elif line == '<end count data>\n':
  15. reader = False
  16. else:
  17. done = True
  18. return result[:-1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement