标签:exec 简单 you 返回值 交互 style single pil com
简单流程(无返回值)
code1 = ‘for i in range (0,10):print(i)‘ compile1 = compile(code1,‘‘,‘exec‘) exec(compile1)
简单计算(有返回值) code2 = ‘1+2+3+4‘ compile2 = compile(code2,‘‘,‘eval‘) print(eval(compile2))
简单交互 code3 = name = input(‘please input your name:‘) compile3 = compile(code3,‘‘,‘single‘) name exec(compile3)
浮点数(有限循环小数,无限循环小数)
标签:exec 简单 you 返回值 交互 style single pil com
原文地址:https://www.cnblogs.com/fate2048/p/10018079.html