test.py所在文件夹C:\Users\PC\Desktop\测试路径\test.py
#coding:utf-8 import logging import os #当前目录 currentpath=unicode(os.getcwd(),'gbk') print currentpath #C:\Users\PC\Desktop\测试路径 #上一级目录 path=os.path.dirname(unicode(os.getcwd(),'gbk')) print path #C:\Users\PC\Desktop #路径拼接 newpath=path+u"\说明.txt"