On Mar 31, 5:31 pm, [EMAIL PROTECTED] wrote:
> Can you have a Python object stored entirely on disk?

import cPickle as cp

class Dog(object):
    def __init__(self, name):
        self.name = name

d = Dog("Spot")

f = open("data.txt", "w")
cp.dump(d, f)
f.close()

f = open("data.txt")
stored_obj = cp.load(f)
print stored_obj.name

--output:--
Spot
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to