Thanks guys.  This is for serializing to disk.  I was hoping to not
have to use too many intermediate steps, but I couldn't figure out how
to pickle data into zipfile without using either intermediate string
or file.  That's cool here's what I'll probably settle on (tested) -
now just need to reverse steps for the open function.

def saveOjb(self, dataObj):
    fName = self.version + '_' + self.modname + '.dat'
    f = open(fName, 'w')
    dStr = pickle.dumps(dataObj)
    c = dStr.encode("bz2")
    pickle.dump(c, f, pickle.HIGHEST_PROTOCOL)
    f.close()

I'm glad to see that "encode()" is not one of the string ops on the
deprecate list (using Python 2.5).

Thx,
Mark
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to