Python 的execfile用法
2013-11-13 13:13 zoo-code 阅读(2723) 评论(0) 编辑 收藏 举报可以直接执行脚本 而import是将脚本导入另一个文件里,可以看
http://docs.python.org/2/library/functions.html
例如一个Python文件 a.py:
def hello(a): print a hello(test)
在Python命令行使用:
execfile("a.py", {"test": "hello world"})
就能够执行函数了 看来execfile这个函数很方便测试使用。