python compile code object -- reverse how to
leo
lgoh at optonline.net
Wed Jul 19 19:31:33 EDT 2006
Hi, all,
i mean to convert
'c\000\000\000\000\001\000\000\000s\017\000\000\00
> 0\177\000\000\177\002\000d\000\000GHd\001\000S(\00
> 2\000\000\000s\005\000\000\000helloN(\000\000\000\
> 000(\000\000\000\000s\010\000\000\000<script>s\001'
to the orig script
""" print 'hello' """
Thanks
"leo" <lgoh at optonline.net> wrote in message
news:ntyvg.464$8F.378 at fe09.lga...
> Hi,
> following is the python scripts:
> import marshal
> script = """
> print 'hello'
> """
> code = compile(script, "<script>", "exec")
> data = marshal.dumps(code)
> print repr(data)
> the result:'c\000\000\000\000\001\000\000\000s\017\000\000\00
> 0\177\000\000\177\002\000d\000\000GHd\001\000S(\00
> 2\000\000\000s\005\000\000\000helloN(\000\000\000\
> 000(\000\000\000\000s\010\000\000\000<script>s\001
> \000\000\000?\002\000s\000\000\000\000'how to convert the result code to
> orig script """print 'hello'"""thanks
>
>
More information about the Python-list
mailing list