美文网首页
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函数

    config= {}execfile("config.txt",config) 程序会报错,没有execfile函...

  • python 中 exec、 eval、 execfile 和

    文章转载自python 中 exec、 eval、 execfile 和 compile 用法.当然,这里的版本应...

  • Nodejs spawn 之stdio

    spawn,exec,execFile和fork关系 从上图可以看出,在用户层面其他的三个函数都调用了child_...

  • execfile语句

    python2里的excefile语句可以像执行python代码那样使用字符串。不同的是exec使用字符串,而ex...

  • python笔记--exec、eval、execfile和com

    有些时候可能会需要动态地创造Python代码,然后将其作为语句执行或作为表达式计算。简单的说,exec和e...

  • Python高阶函数学习笔记

    python中的高阶函数是指能够接收函数作为参数的函数 python中map()函数map()是 Python 内...

  • child_process

    在使用 child_process 模块中的 exec 、execFile、spawnSync、execFileS...

  • Python - 2017/01/28-函数

    调用python内置函数 函数名(参数) 即可调用python内置函数 help(函数名) 返回python对于函...

  • Python函数式介绍一 - 高阶函数

    Python函数式介绍一 - 高阶函数Python函数式介绍二 - 链式调用 最近为了给朋友推广Python函数式...

  • Python:内置函数

    python的内置函数,匿名函数 内置函数 内置函数就是python给你提供的,拿来直接用的函数,比如print,...

网友评论

      本文标题:python的execfile函数

      本文链接:https://www.haomeiwen.com/subject/ezaweqtx.html