重新组装Python字节码为原始代码?

编程入门 行业动态 更新时间:2024-10-25 20:26:25
本文介绍了重新组装Python字节码为原始代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这可能是一个愚蠢的问题,但是考虑到输出结果,例如。

This might be a silly question, but, given the output of, say..

>>> from dis import dis >>> def myfunc(x): ... print x ** 2 ... >>> dis(myfunc) 2 0 LOAD_FAST 0 (x) 3 LOAD_CONST 1 (2) 6 BINARY_POWER 7 PRINT_ITEM 8 PRINT_NEWLINE 9 LOAD_CONST 0 (None) 12 RETURN_VALUE

..或 .pyc 文件-是否可以将其重新组装成有效的Python源代码?也就是说,其中 reassemble(dis(myfunc))== def reassembled_function(x):\n print x ** 2;

..or a .pyc file - is it possible to reassembling this into a valid piece of Python source code? I.e where reassemble(dis(myfunc)) == "def reassembled_function(x):\n print x ** 2"

不是出于任何特定的实际原因,我只是想知道这是否可行或已尝试。。

Not for any particular practical reason, I'm just curious if this is possible, or has been attempted..

  • 不是在线服务的免费Python反编译器?
  • Free Python decompiler that is not an online service?
推荐答案

sourceforge/projects/decompyle/

更多推荐

重新组装Python字节码为原始代码?

本文发布于:2023-10-24 09:27:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1523580.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字节   原始   代码   Python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!