📅  最后修改于: 2022-03-11 14:45:11.193000             🧑  作者: Mango
import os
>>> base=os.path.basename('/root/dir/sub/file.ext')
>>> base
'file.ext'
>>> os.path.splitext(base)
('file', '.ext')
>>> os.path.splitext(base)[0]
'file'