2013-11-02 71 views

回答

2

似乎沒有辦法使用zipfile模塊執行此操作。我解決它使用子模塊:

from subprocess import check_output, CalledProcessError, STDOUT 

try: 
    check_output(['unzip', '-q', my_zipfile, '-d', destination], stderr=STDOUT) 

...

except CalledProcessError as err: 
    (use err.cmd, err.returncode and err.output to take action) 
相關問題