send2trash 文件移至回收站¶ 概要: 使用Python将文件移至回收站/废纸篓 创建时间: 2022.10.07 15:47:44 更新时间: 2023.07.28 22:43:54 简介¶ send2trash是一个用于将文件(夹)移动到回收站/废纸篓的Python包,使Python具有不直接删除文件的能力 安装¶ Bash1pip install -U send2trash 使用¶ 移除单个文件/文件夹¶ Python1 2 3 4from send2trash import send2trash send2trash(file1) send2trash(dir1) 移除一组文件/文件夹¶ Python1 2 3 4from send2trash import send2trash send2trash([file1, file2, file3]) send2trash([dir1, dir2, dir3]) 参考¶ arsenetar/send2trash: Python library to natively send files to Trash (or Recycle bin) on all platforms.