[Tutor] Problem with data storage

Jacob S. keridee at jayco.net
Fri Dec 3 03:26:15 CET 2004


The way I do it is as follows.

def open():
    a = open('myfile.txt','r')
    di = a.read()
    di = eval(di)
    return di

def save(di):
    a = open('myfile.txt','w')

def dosomethingwithdi(di):
    '''You can put whatever you want in here
    for example...'''
    print di
    di['key'] = 'value'
    print 'Done'

Jacob Schmidt

> Hello,
> I'm building an app that needs to get input from the user and compare
> it to data that should be in some kind of data storage file.
> The problem is that I dont know what data storage file/module to use...
> I need it to be easy for the user to edit by himself (I don't want to
> make an UI to edit the file), organized as list of pairs (or a table)
> and multy platform (if no such thing then WIN only).
> Thanks!!
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list