python处理系统路径的相关操作:
# -*- coding: utf-8 -*- import os # 属性 print '__file__: %s' % __file__ # 绝对路径(包含文件名) abspath = os.path.abspath(__file__) print('abspath: %s' % abspath) # 路径(剔除文件名) dirname = os.path.dirname(abspath) print('dirname: %s' % dirname)