Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在python中,我们可以使用以下内容:
symtable.symtable(code,file,compile type)
但是有可能让一个symtable对象成为当前的可执行代码吗?
symtable
可执行代码本身携带该信息。请参阅inspect模块文档,但代码对象有co_namesand co_varnames,例如。
inspect
co_names
co_varnames