Data store solution need help

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Fri May 14 09:42:00 EDT 2010


Haulyn Jason a écrit :
> Hi, all:
> 
> I am a Java programmer, now I am working on a Python program. At the 
> moment, I need to store some data from user's input, no database, no 
> xml, no txt(we can not make users open the data file by vim or other 
> text editor).
> 
> Any suggestions or reference url? Is there a lib should do this or I 
> need to implement it myself?
> 
> PS: if I want to implement it myself, which part of python document I 
> need to learn? I know how to write txt files now, but not further for me.
> 

Not sure I really understand whether you want to store your data in just 
any format or if it need to be a "binary" format or else... And you 
don't tell much about how your data structure and how it will be used.

Anyway: two possible solutions are csv or serialization.

For the first option, see the csv module
http://docs.python.org/library/csv.html#module-csv

For the second, look at pickle and shelve modules:
http://docs.python.org/library/pickle.html#module-pickle
http://docs.python.org/library/shelve.html#module-shelve


If none of this fits your needs, please provide more details !-)
HTH



More information about the Python-list mailing list