config= {}
execfile("config.txt",config)
程序会报错,没有execfile函数,这是因为python3 删去了 execfile(),代替方法如下:
with open('test1.py','r') as f:
exec(f.read())
config= {}
execfile("config.txt",config)
程序会报错,没有execfile函数,这是因为python3 删去了 execfile(),代替方法如下:
with open('test1.py','r') as f:
exec(f.read())
本文标题:python的execfile函数
本文链接:https://www.haomeiwen.com/subject/ezaweqtx.html
网友评论