requests中文文档API:http://docs.python-requests.org/zh_CN/latest/index.html
下载和解压压缩包方法
import requests
import zipfile
import os
response = requests.get(url) # 获取内容
zipPath = '.../filename.zip' # 压缩包的绝对路径
dezipPath = '.../filename/' # 解压缩后文件夹的绝对路径,remove '.zip'
with open(zipPath, 'wb') as file:
file.write(response.content) # 通过二进制写文件的方式保存获取的内容
file.flush()
f = zipfile.ZipFile(zipPath) # 创建压缩包对象
f.extractall(dezipPath) # 压缩包解压缩
f.close()
os.remove(zipPath) # 删除原始压缩包