Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在运行一个脚本,我需要关闭所有打开的 Firefox 会话。需要关闭它们才能查看我的设备上的最终日志。我怎样才能关闭它们?
看看psutil模块。您问题的代码:
import psutil for process in psutil.process_iter(): if 'firefox' in process.name: process.kill()