python爬虫之requests(1) 实战:爬取百度网页html 1.指定URL 2.UA伪装 3.发起请求(模拟浏览器) requests(URL=URL,Headers=headers) 4.获取响应数据 返回response对象 Content-Type查看是text/html还是Json格式 5.解析数据 Beautifulsoup、正则表达式、xpath 6.持久化存储 补充response属性 # respone属性 print(respone.text) # 获取响应的页面内容 print(respone.content) # 获取二进制页面内容