Hi,
The example below shows that result of a marshaled data structure is
nothing but a string
[color=blue][color=green][color=darkred]
>>> data = {2:'two', 3:'three'}
>>> import marshal
>>> bytes = marshal.dumps(d ata)
>>> type(bytes)[/color][/color][/color]
<type 'str'>[color=blue][color=green][color=darkred]
>>> bytes[/color][/color][/color]
'{i\x02\x00\x00 \x00t\x03\x00\x 00\x00twoi\x03\ x00\x00\x00t\x0 5\x00\x00\x00th ree0'
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?
Am I missing out something?
Thanks,
Mike
The example below shows that result of a marshaled data structure is
nothing but a string
[color=blue][color=green][color=darkred]
>>> data = {2:'two', 3:'three'}
>>> import marshal
>>> bytes = marshal.dumps(d ata)
>>> type(bytes)[/color][/color][/color]
<type 'str'>[color=blue][color=green][color=darkred]
>>> bytes[/color][/color][/color]
'{i\x02\x00\x00 \x00t\x03\x00\x 00\x00twoi\x03\ x00\x00\x00t\x0 5\x00\x00\x00th ree0'
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?
Am I missing out something?
Thanks,
Mike
Comment