Python里面怎样让EXE运行完成后删除自身?
说一个简单的方法,
利用cmd命令删除,首先利用python的subprocess模块创建一个子进程
p=subprocesse.Popen("cmd",stdin= subprocess. PIPE)>
p.stdin.write(':Repeat\r\n
del "要删除.exe"\r\n
if exist "要删除.exe" goto Repeat\r\n
del "要删除.exe"\r\n');
文件名可以利用函数动态获取。
Copyright © 广州京杭网络科技有限公司 2005-2025 版权所有 粤ICP备16019765号
广州京杭网络科技有限公司 版权所有