on-internet
← Community

How can I execute code received from dis.dis() python?

Stack Overflow ·

How can I execute code received from dis.dis() python? import dis class A(): def __init__(self): print("hello") dis.dis(A) '''It returns: 3 0 LOAD_GLOBAL 0 (print) 2 LOAD_CONST 1 ('hello') 4 CALL_FUNCTION 1 6 POP_TOP 8 LOAD_CONST 0 (None) 10 RETURN_VALUE ''' I want something like this: import dis dis.run(''' 3 0 LOAD_GLOBAL 0 (print) 2 LOAD_CONST 1 ('hello') 4 CALL_FUNCTION 1 6 POP_TOP 8 LOAD_CONST 0 (None) 10 RETURN_VALUE ''') i.e. Execute python disassembler.(I can execute .pyc from python ,can i execute disassembler?)

Comments

Sign in or sign up to comment and upvote.

No comments yet.