代码保存图片不完整,其中链接用IDM下载后实际大小在400多K,但用py保存时始终只有4.4K。请教该如何修改,代码如下
[Python] 纯文本查看 复制代码 import requests
url = "https://image.mangabz.com/1/139/287339/2_5673.jpg?cid=287339&key=3477511deeaec1600683ee42aeca2d0a&uk="
filename = "manga_image.jpg"
response = requests.get(url)
with open(filename, 'wb') as f:
f.write(response.content)
[Python] 纯文本查看 复制代码 import requests
url = "https://image.mangabz.com/1/139/287339/2_5673.jpg?cid=287339&key=3477511deeaec1600683ee42aeca2d0a&uk="
filename = "manga_image.jpg"
response = requests.get(url, stream=True)
with open(filename, 'wb') as f:
for chunk in response.iter_content(chunk_size=8192):
if chunk:
f.write(chunk)
|