+ 1
Is there a better way to save data in Python?
Today, i was trying to save a string in a file and it worked, but i was thinking is there another way to do this? Is this the best way? or is there another way that is better? and how do i save things like variables? Please explain why something is better and why this is bad or good.
2 Antworten
+ 7
You can always dump() it with pickle. Works like a charm and saves/restores your data objects exactly how you want them. I prepared an example with a dictionary, but it works alright with much more complex data structures, too.
https://code.sololearn.com/cNXRdhIOg17U/?ref=app
0
Thank you for answering my question i will look into pickle.