设置当前工作目录:import os ;os.chdir('要设置的当前目录')
sys.path.append:添加模块的搜索路径
sys.path:返回模块的搜索路径
如果要在python2的py文件里面写中文,
则必须要添加一行声明文件编码的注释,否则python2会默认使用ASCII编码。
# -*- coding:utf-8 -*-
在Python中运行Python文件:
方法一:
import os
os.system("python filename")
方法二:
execfile('xx.py')
“路径是绝对路径”
转载于:https://www.cnblogs.com/dgq-blog/p/6260600.html