美文网首页
python的execfile函数

python的execfile函数

作者: minlover | 来源:发表于2019-02-17 09:57 被阅读0次

    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