from pathlib import Path Path('/root/dir/sub/file.ext').stem. will return 'file'. 注意,如果你的文件有多个扩展名, .stem 将只删除最后一个扩展名。
確定! 回上一頁