Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def serialize_to_str_file(file_path, object):
- with open(file_path, 'w') as file:
- for line in object:
- file.write(str(line) + '\n')
- def deserialize_from_str_file(file_path):
- lst = []
- with open(file_path, 'r') as file:
- for line in file:
- mline = line.replace('\n', "")
- ev = ast.literal_eval(mline)
- lst.append(ev)
- return lst
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement