Python save module -


i got main program named gui.py , module student.py. in student.py got 1 list conatins (id, name, surname, id2, adress) imported student.py , shows normally.

in main program when click add student, appends list not save it.

can me please?

def odabran () :     return int(select.curselection()[0]) #odabire metodom curselection-a     (miĊĦem odabrano) daje pretvara u int  def dodajred () :     lista.append ([id_v.get(), ime_v.get(), prezime_v.get(),   brojindexa_v.get(), adresa_v.get()])     setselect ()  def azurirajred() :     lista[odabran()] = [id_v.get(), ime_v.get(), prezime_v.get(), brojindexa_v.get(), adresa_v.get()]     setselect ()  def obrisired() :     del lista[odabran()]     setselect ()  def setselect ():     lista.sort()     select.delete(0, end)     id, ime, prezime, brojindexa, adresa in lista :         select.insert (end, id) 

student.py

lista = [   [0, "damir", "gugar", "a455klp", "sesmislava 2"],   [1, "jozo", "pleh", "585klpd", "jozina avenija 44a"],   [2, "ana", "studa", "dd22223", "ivana gorice 11"]] 

the code works good, every time open program it's original list in here, can't update it.

in order save student data in module, looks need manually input list. python not save contents of while running module, module has save data itself, such text file or file on server or database.


Comments