+ 6
Making dictionary as user input, then save it into json file
It works for only one time. I want to save keywords and values as much as I want. I want to create a dictionary database. The file saves the dict, but if you start the program again, the file resets. https://www.sololearn.com/post/1431958/?ref=app
5 ответов
+ 4
Using "w" in open() overwrites any content that is in the file.
Use "a" to append.
https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/python_file_handling.asp
+ 2
Lol did you even read the code? My code doesn't have users deal with dictionary syntax silly. It creates , reads, and writes a dictionary to/from a file with a command line interface. Im not gunna write your code for you. But if you take some time and figure out how mine works, you can make your program.
+ 2
Read the file.
Add to dictionary.
Write the file.
0
Look at this, this program reads and writes dictionaries to a file using the json library
https://code.sololearn.com/c7ZKwzGuu5O5/?ref=app
0
Simon Sauter
Not work bro output :
{"amit": "hello"}{"hello": "amit"}
want this type of output :
{"amit": "hello", "hello": "amit"}