Marshal Obj is String or Binary?

Steven D'Aprano steve at REMOVETHIScyber.com.au
Sat Jan 14 07:44:42 CET 2006


On Fri, 13 Jan 2006 22:20:27 -0800, Mike wrote:

> Thanks everyone. It seems broken storing complex structures as escaped
> strings, but I think I'll take my changes. 


Have you read the marshal reference?

http://docs.python.org/lib/module-marshal.html

marshal doesn't store data as escaped strings, it stores them as binary
strings. When you print the binary string to the console, unprintable
characters are shown escaped.

I'm guessing you probably want to use pickle instead of marshal. marshal
is intended only for dealing with .pyc files, and has some important
limitations. pickle is intended to be a general purpose serializer.


-- 
Steve.




More information about the Python-list mailing list