天天看點

73 - 使用requests下載下傳二進制檔案

如何使用requests從網絡上下載下傳一個圖像檔案

import requests

req = requests.get('http://t.cn/EfgN7gz')
# print(req.text)
with open('files/book.png', 'wb') as f:
    f.write(req.content)