比如说现在有这么一段字符串,"print('helloworld')",那么怎么将其转换成python认识的格式运行?
s="print('helloworld')" r = compile(s,"<string>", "exec") exec(r)
输出:helloworld
比如说现在有这么一段字符串,"print('helloworld')",那么怎么将其转换成python认识的格式运行?
s="print('helloworld')" r = compile(s,"<string>", "exec") exec(r)
输出:helloworld
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。