Below I will share with you an example of obtaining file path, file name, and suffix name in python. It has a good reference value and I hope it will be helpful to everyone. Let’s take a look together
The example is as follows:
#########start 获取文件路径、文件名、后缀名############ def jwkj_get_filePath_fileName_fileExt(filename): (filepath,tempfilename) = os.path.split(filename); (shotname,extension) = os.path.splitext(tempfilename); return filepath,shotname,extension #########end 获取文件路径、文件名、后缀名############
Related recommendations:
Teach you how to use python to get the time of a specified time difference
Code sharing for python to get faces
The above is the detailed content of Examples of Python getting file path, file name, and suffix. For more information, please follow other related articles on the PHP Chinese website!