Mike wrote: > Hi, > > The example below shows that result of a marshaled data structure is > nothing but a string > > >>>>data = {2:'two', 3:'three'} >>>>import marshal >>>>bytes = marshal.dumps(data) >>>>type(bytes) > > <type 'str'> > >>>>bytes > > '{i\x02\x00\x00\x00t\x03\x00\x00\x00twoi\x03\x00\x00\x00t\x05\x00\x00\x00three0' > > Now, I need to store this data safely in my database as CLEAR TEXT, not > BLOB. It seems to me that it should work just fine since it is string > anyways. So, why does O'reilly's Python Cookbook is insisting in saving > it as a binary file and BLOB type? > Well, the Cookbook isn't an exhaustive list of everything you can do with Python, it's just a record of some of the things people *have* done.
I presume your database has no datatype that will store binary data of indeterminate length? Clearly that would be the most satisfactory solution. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list