解决 FileNotFoundError: [WinError 2] 系统找不到指定的文件
根据提示找到lib中的subprocess.py文件
__init__函数中的shell = False 改成shell = True
import os
import time
start_t=time.time()
import subprocess
import zipfile
def brutecrack():
for i in range(100000,123459):
passwd=str(i)
#python的根目录:k:/python/,而dos的根目录:c/Users/ZSC,如果7-Zip不安装在python的根目录,就要cd /d
command='cd /d C:/Users/ZSC/ && 7z -p'+passwd+' t K:/python/captcha.zip'
#t 表示test,不进行实际解压,只测试密码
print(passwd)
child=subprocess.call(command)
#os.popen(command)#这个也可以用,但是不好监控解压状态
print(child)
if child==0:
print("压缩包密码为:"+passwd)
return
brutecrack()
print(time.time()-start_t)
挺慢的