On 05/14/2010 08:18 AM, Haulyn Jason wrote:
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).

You don't mention what type of data you want to store? Is it a single string? Multiple strings? Complex nested data?

And how do you want to access it?

Python provides you any number of options:

- you can use standard Python file objects to read/write content in a file format of your own definition

- you can use the ConfigParser module to read/write an old-school .INI style file (which can also be edited in a text editor, but doesn't have to be)

- you can use the "anydbm" module to store key/value pairs of strings with an internal user-interface much like a dictionary

- you can use the "pickle" module to persist Python objects into files

- you can use the "shelve" module to combine the "pickle" persistence with the DBM layer

- you can use the built-in (as of Python2.5) "sqlite3" module for a single-file database with full SQL capabilities without the need to install a SQL server (MySQL, PostgreSQL, MS SQL Server, etc)

- you can persist to cloud storage or to your own web-server using the urllib/urllib2 modules


But without knowing what you want to store or how you want to access it, it's hard to offer more concrete advice.

-tkc






--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to