python 函数内使用 exec() 的注意事项 |
您所在的位置:网站首页 › eval函数使用注意事项 › python 函数内使用 exec() 的注意事项 |
python 函数内使用 exec() 的注意事项
CharlesCai-蔡沐含:
谢谢 feng_feng_peng: def fun() lc=locals() exec('b=1+1') b=lc['b'] print(b) fun() 参考一下这个 python 函数内使用 exec() 的注意事项CharlesCai-蔡沐含: 具体怎么用请问一下。 [code=python] try: with open(place+"备忘录"+os.sep+"messages.dll","r") as o: read=o.read() print("dict = "+read) exec("dict = "+read) except: os.system("mkdir "+place+"备忘录") with open(place+"备忘录"+os.sep+"messages.dll","w") as o: dict={"默认":{"messages":[{"message":"欢迎使用备忘录","time":strftime("%Y/%m/%d %H:%M:%S"),"title":"其他"}],"color":"#DDDDDD"}} o.write(str(dict)) [/code] try里面的死活不执行,请教一下,谢谢。 小波变换入门英文介绍文献原味吐司: 细节还可以再详细点 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |