python中的exec()方法

exec()方法能够执行python的代码,传入的参数为字符串

exec_str = "print('hello world')"
exec(exec_str)

执行结果为'hello world'python

相关文章
相关标签/搜索