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.
--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
--
http://mail.python.org/mailman/listinfo/python-list