标签:coding desktop python2 路径 python code class 拼接 getcwd
test.py所在文件夹C:\Users\yutu405.yutu405-PC\Desktop\测试路径\test.py
#coding:utf-8 import logging import os #当前目录 currentpath=unicode(os.getcwd(),‘gbk‘) print currentpath #C:\Users\yutu405.yutu405-PC\Desktop\测试路径 #上一级目录 path=os.path.dirname(unicode(os.getcwd(),‘gbk‘)) print path #C:\Users\yutu405.yutu405-PC\Desktop #路径拼接 newpath=path+u"\说明.txt"
标签:coding desktop python2 路径 python code class 拼接 getcwd
原文地址:https://www.cnblogs.com/shinesea/p/9293298.html