@author jackzhenguo @desc @date 2019/9/10 103 获取后缀名 import os file_ext = os.path.splitext('./data/py/test.py') front,ext = file_ext In [5]: front Out[5]: './data/py/test' In [6]: ext Out[6]: '.py'