I have created a bytestream (readfile.pkl) from pickle.dump() already in
different folder (say /tmp) succesfully. Now I wish to open the file, read
it and finally write the output to a file to "output.txt".

To read the file bytestream file (readfile.pkl) I did perform as --

---
import pickle

def print_report():
    with open('/tmp/readfile.pkl', 'rb') as f:
        my_shared = pickle.load(f)
            print my_shared
    print "================================================================"

--

My above code should perform all 3 of below -

(a) Open the pickle file as above
(b) read the pickled object
(c) write the output to a file say "output.txt"

Can I have know if my above code is reading properly and how to write to an
output file 'output.txt'
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to