pickle handling multiple objects ..

Smiley 4321 ssmile03 at gmail.com
Sun Feb 26 12:25:23 CET 2012

If I have a sample python code to be executed on Linux. How should  I
handle multiple objects with 'pickle' as below -


import pickle

#my_list = {'a': 'Apple', 'b': 'Mango', 'c': 'Orange', 'd': 'Pineapple'}
#my_list = ('Apple', 'Mango', 'Orange', 'Pineapple')
my_list = ['Apple', 'Mango', 'Orange', 'Pineapple']
#my_list = ()
output = open('readfile.pkl', 'wb')
pickle.dump(my_list, output)

my_file = open('readfile.pkl', 'rb')
my_list2 = pickle.load(my_file)

print my_list
print my_list2

This code works fine but now I have to handle multiple objects?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120226/83ba7a3c/attachment.html>

More information about the Python-list mailing list