devicetype-library/tests/pickle_operations.py

15 lines
336 B
Python
Raw Normal View History

2024-03-22 21:36:57 +01:00
import pickle
def write_pickle_data(data, file_path):
with open(file_path, 'wb') as pickle_file:
pickle.dump(data, pickle_file)
pickle_file.close()
def read_pickle_data(file_path):
with open(file_path, 'rb') as pickle_file:
data = pickle.load(pickle_file)
pickle_file.close()
return data