Skip to main content
 首页 » 编程设计

python之如何从 Windows 的回收站中删除文件 Python

2025年05月04日15bluestorm

我正在尝试使用 python 删除回收站中的文件,但找不到执行此操作的方法。 谢谢。

请您参考如下方法:

对于 Windows 操作系统,您可以使用 winshell模块,它是 empty方法。

清空回收站非常简单:

import winshell 
winshell.recycle_bin().empty(confirm=False, show_progress=False, sound=False) 

查看一些 examples here .