开发者

Complement function of compiler.parse() in python

The compiler.parse() function in python give me the compiled code of an开发者_C百科 expression. For ex: compiler.parse('a/b/c')

generates

Module(None, Stmt([Discard(Div((Div((Name('a'), Name('b'))), Name('c'))))]))

How can I do the reverse of it; meaning given the compiled statement how can I get a/b/c?

PS :: I know that compiler module is deprecated in python2.7 and python3.0 but it seems to be the only thing for my work!


uncompyle actually uncompiles 2.7 bytecode, so you might want check if you can hook into that with your parsed code after compilation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜