I have a dictionary that looks like this for example:
obj = {'a':['d','f','g'], 'x':['y','z','w']}
I save it to a pickle file using:
with open(str(file_path), 'wb') as f:
pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL)
and read it back with:
with open(str(file_path), 'rb') as f:
return pickle.load(f)
but now the lists are strings that looks like lists:
{'a':"['d','f','g']", 'x':"['y','z','w']"}
Is there a way of reading it back straight as a list?
Note: I can convert it back from strings to lists with ast.literal_eval(list) but it's super slow.
Im using python 3.8, windows 10