python絕技學習筆記第二天

來源:互聯網
上載者:User

標籤:nes   readline   不清楚   pytho   blog   threading   dna   dict   thread   

#coding=utf8
import zipfile
from threading import Thread
import argparse
def extractFile (zFile,password):
try:
zipfile.extractall(pwd = password)
print ‘password is Found:‘ + password
except :
pass

def main ():
parser = argparse.ArgumentParser(usage=‘%prog‘ + ‘-f <zipfile> -d <dictionary>‘)

parser.add_argument(‘-f‘, dest=zname, type=argparse.FileType(‘zipfile‘) , help =‘specify zip file‘)
parser.add_argument(‘-d‘, dest=dname, type=argparse.FileType(‘txt‘) , help =‘specify dictioary file‘)

#(argument,args) = parser.parse_args()
if(zname == None) | (dname == None):
print parser.usage
exit(0)
else:
dname=Argument.dname
zname=Argument.zname

zFile = zipfile.ZipFile(zname)
passFiles =open(dname)
for line in passFiles.readlines() :
password = line.strip(‘\n‘)
t = Thread(target = extractFile, args = (zFile,password))
t.start()

if __name__==‘__main__‘:
main()

 

 

這是我新完善的代碼,但在執行過程中總出錯,目前還不知道怎麼解決,還不清楚官方文檔的解讀方法,如果有哪位大神懂這些,希望不吝賜教,在下不勝感激。

python絕技學習筆記第二天

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.