赞
踩
import os # 文件绝对路径 file_path = r'C:\Users\Administrator\Desktop\1.txt' # 文件后缀 file_suffix = os.path.splitext(file_path)[-1] print(file_suffix) # .txt