使用 os.path.splitext(file)[0] 可获得 文件名 。使用 os.path.splitext(file)[-1] 可获得以 . 开头的 文件后缀名 。
os.path.splitext(file)[0]
os.path.splitext(file)[-1]
.