分离路径和文件名:
os.path.split()
区分文件的名字和后缀:
os.path.splitext()
import os file_path = "D:/test/test.py" (filepath, tempfilename) = os.path.split(file_path) (filename, extension) = os.path.splitext(tempfilename)
分离路径和文件名:
os.path.split()
区分文件的名字和后缀:
os.path.splitext()
import os file_path = "D:/test/test.py" (filepath, tempfilename) = os.path.split(file_path) (filename, extension) = os.path.splitext(tempfilename)