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

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

不言
Release: 2018-04-23 13:44:23
Original
3860 people have browsed it

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 获取文件路径、文件名、后缀名############
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template