首页 > 编程语言 >Python爬取照片

Python爬取照片

时间:2022-10-28 01:22:18浏览次数:44  
标签:照片 请求 Python agent 爬取 user response

实例:爬取内蒙古科技大学校徽

打开网站

 

 

 

 

 

 

1.引入requests模块

 

 

 2.输入要请求的网站url

 

 

 网址获取

 3.发送请求头

 

 user-agent的获取

 

 user-agent的作用是伪装成浏览器,发送请求

4.使用get请求得到返回值赋值给response常量,输出response文本形式

 

 5.with open 方式保存获取的文件

 

 6.最终爬取结果

 

标签:照片,请求,Python,agent,爬取,user,response
From: https://www.cnblogs.com/iqqq/p/16834492.html

相关文章