[Tutor] foreign lists
Sat, 4 Aug 2001 12:23:06 -0600 (MDT)
On Sat, 4 Aug 2001, paul wrote:
> is it possible to access a list from another file and save whatever
changes are made to the list after the original program has been run?
i made a simple book database which matches book titles with certain
attributes each book contains. i want to be able to create the main
list of books and have my program access that list. i also want any
additions made to the list to be changed in that foreign list, so
that next time the program is run, the list will include the new
addition. right now, though, i have it so that each time the program
runs, it starts with a blank list. any suggestions??? if anyone
wants the code, i'll be happy to post that also.
You have a whole lot of choices, which is best depends on what you
want to do with your database (who and what has access, by which
methods, and what your objectives are (fun, education, profit)).
Checking into these three areas should help you see what the options
are: __repr__, eval, open, pickle, etc. (i.e., put it in a file, you
get to do all the work); anydbm (let the system handle the low level
DB stuff); mysql, postgresql, etc. (third-party stuff, lots of
different views of the data, put it on the web)