خرید بک لینک

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

import dis
class A():
    def __init__(self):
        print("hello")
dis.dis(A)
'''It retus:
  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?)

برچسب: نویسنده: استخدام کار تاريخ: شنبه 30 آبان 1405 ساعت: 17:40

صفحه بندی