Home  >  Article  >  Backend Development  >  Examples of Python getting file path, file name, and suffix

Examples of Python getting file path, file name, and suffix

不言
不言Original
2018-04-23 13:44:233804browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn