Thanks... works like a charm :-)
On Wed, 26 Jan 2005 12:55:38 +0100, Peter Maas <[EMAIL PROTECTED]> wrote:
Johan Kohler schrieb:
class person:
name =""
age = 0
friends=[]
comment=""""""
me = person()
Otherwise, what is the best "Python" way to write and read this data
structure?
import pickle
class person:
name =""
age = 0
friends=[]
comment=""""""
me = person()
# store
pf = file('/tmp/pickletest', 'w')
pickle.dump(me, pf)
pf.close()
# load
pf = file('/tmp/pickletest', 'r')
me2 = pickle.load(pf)
pf.close()
This is sequential access. If you want to have random access, look
for shelve.
--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
--------------------------------------------------------------------
Please find our disclaimer at http://www.ukzn.ac.za/disclaimer
--------------------------------------------------------------------
<<<<gwavasig>>>>
--
http://mail.python.org/mailman/listinfo/python-list