2024-03-28 14:50:20 发布
网友
test_str = ''' def test(): print("test") def hello(): print("hello") test() hello() ''' def main(): exec(test_str, globals(), locals()) main()
输出:
hello name 'test' is not defined
但是如果我把locals()改成globals(),一切都好!为什么?你知道吗
目前没有回答
目前没有回答
相关问题 更多 >
编程相关推荐