import osp=os.path.dirname('C:\\win\\yes\\text.txt')print pprint os.path.split(p+"\\")#目录与文件分离print os.path.split(p)print os.path.dirname(p)#the first half of the pair returned by split(path).print os.path.basename(p)#the second half of the pair returned by split(path).print os.pat Read More