Code:
import os FilePath = "/a/bb/ccc/dddd.png" FolderPath, FullFileName = os.path.split(FilePath) Name, Suffix = os.path.splitext(FullFileName) print("文件路径: {}\n文件全名: {}\n文件名: {}\n文件后缀: {}".format(FolderPath, FullFileName, Name, Suffix))
Result:
Code:
import os FilePath = "/a/bb/ccc/dddd.png" FolderPath, FullFileName = os.path.split(FilePath) Name, Suffix = os.path.splitext(FullFileName) print("文件路径: {}\n文件全名: {}\n文件名: {}\n文件后缀: {}".format(FolderPath, FullFileName, Name, Suffix))
Result: