+ 1
How to store dictonries and List in filez
Suppose i have dynamic lists and depend on user choice that how many record how many record he wants to add he can added For example He run a program and add 3 recordss added when he run again that program there should be 3 record stored in file and if he want to add more record he the previous record should be maintian in file So how can i do this ? Sorrt for bad english
6 Antworten
+ 6
HonFu. you were faster than me. I got the same idea with serializing objects with pickle.
+ 5
There is a possibility to store dicts to a csv file (= comma separated values). Therefore use the csv module with:
import csv
This module has classes DictReader and DictWriter. I never used csv this way but I am sure you can find some code snippets to see how it should be.
For general use of reading and writing files see my tutorial:
https://code.sololearn.com/cESZeFlM1cRR/?ref=app
+ 4
The pickle module is easy to use when you don't need the data outside of Python.
You can also use json; codewise it's similarly easy.
You can also manually write the data to a txt file and read it from there, a few more lines of code then.
+ 3
Just google pickle. It is really, really simple, you will definitely get it.
+ 2
Ok thanks i will
0
Thankew Lothar but actually i am begginner its hard to understand for me 😢
I am a ist semester studnt and i have book managment systmet project whi h i almost completed i have used dictionaries also for bttr result now all i just i want to add files functionality in my project i just need a little idea of this thankew for your help btw 😊😊