How can we memorize dictionary type ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can we memorize dictionary type ?

I am developing password generator and recorder. So Program is needed to memorize password are generated. I used Pickle, but memorizing password, I finish program (using exit()). And next, I run program, password could not are memorized. What is the way of memorizing dictionary tope of python? I want to memorize dictionary tipe.

3rd Mar 2017, 3:13 PM
Kengo
Kengo - avatar
3 Answers
+ 6
Do you mean storing it in a file? If so, you have to use a syntax: pickle.dump(data_to_be_stored, file_handler_name, pickle_protocol) Check out an example here: https://code.sololearn.com/cF7C0clYwAfQ/#py
3rd Mar 2017, 4:48 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 6
Your question has actually inspired me to write a simple demonstration on how pickle is used. See here: https://code.sololearn.com/cNXRdhIOg17U/?ref=app I tried pickle with class-type data (very complex) and it managed to write it to a file and later on unpack it perfectly. Seems a good way to store data that should not be easy to access simply by reading a file.
3rd Mar 2017, 9:32 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
0
Thank you, kuba!! I check it!
6th Mar 2017, 3:51 PM
Kengo
Kengo - avatar