request到response
- 瀏覽器發送消息(請求)到服務器,這個過程叫HTTP Request
- 服務器返回瀏覽器信息,HTTP Response
- 瀏覽器處理信息,展示
從windows資源管理器中直接複製地址會導致文件寫入錯誤(路徑錯誤)[Errno 22] Invalid argument
import requests response = requests.get('http://www.baidu.com/img/baidu_jgylogo3.gif') print(response.content) with open('C:\FeigeDownload\1.gif','wb')as f: f.write(response.content) f.close
import requests response = requests.get('http://www.baidu.com/img/baidu_jgylogo3.gif') print(response.content) with open('C:/FeigeDownload/1.gif','wb')as f: f.write(response.content) f.close