import parser ast = parser.suite('print "hello"') code = ast.compile() exec code print ast.totuple()
実行すると
hello
(257, (267, (268, (269, (272, (1, 'print'), (304, (305, (306, (307, (308, (310, (311, (312, (313, (314, (315, (316, (317, (318, (3, '"hello"'))))))))))))))))), (4, ''))), (0, ''))
(257, (267, (268, (269, (272, (1, 'print'), (304, (305, (306, (307, (308, (310, (311, (312, (313, (314, (315, (316, (317, (318, (3, '"hello"'))))))))))))))))), (4, ''))), (0, ''))
詳細はドキュメントで
0 件のコメント:
コメントを投稿