文件代码:
[root@jenkins chap10]# cat unzipfile.py
import zipfile
with zipfile.ZipFile('subprocess.zip', 'r') as zf:
print zf.namelist()
for file in zf.namelist():
zf.extract(file,'/root/')
运行
[root@jenkins chap10]# python unzipfile.py
['subprocess_pipes.py']
[root@jenkins chap10]# ls /root/subprocess_pipes.py
/root/subprocess_pipes.py
[root@jenkins chap10]#