python的execfile函数

2019-02-17  本文已影响0人  minlover

config= {}

execfile("config.txt",config)

程序会报错,没有execfile函数,这是因为python3 删去了 execfile(),代替方法如下:

with open('test1.py','r') as f: 

         exec(f.read())

上一篇下一篇

猜你喜欢

热点阅读