import os
# path
path = '/home/User/Desktop/file.txt'
# Split the path in
# head and tail pair
head_tail = os.path.split(path)
# print head and tail
# of the specified path
print("Head of '% s:'" % path, head_tail[0])
print("Tail of '% s:'" % path, head_tail[1], "\n")
对
使用
os.path.split()
例如:
相关问题 更多 >
编程相关推荐