What is a Python code object?

前端 未结 3 1609
花落未央
花落未央 2021-02-01 03:40

While trying to use Python\'s \"exec\" statement, I got the following error:

TypeError: exec: arg 1 must be a string, file, or code object

I do

3条回答
  •  轮回少年
    2021-02-01 04:13

    There is an excellent blog post by Dan Crosta explaining this topic, including how to create code objects manually, and how to disassemble them again:

    Exploring Python Code Objects

提交回复
热议问题