1.Python3 解析路径
示例代码:
#!/usr/bin/python
from urllib.parse import urlparse
import os.path
'''
根据路径获取文件名
'''
def get_path_info(path):
pathinfo = os.path.split(path);
return pathinfo;
pathinfo = get_path_info('E:\\web\\python\\demo.txt');
print(pathinfo);
示例截图:
运行截图: