程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python crawler tutorial 1 - 119 Baidu

編輯:Python

Blogger introduction : We-Media JavaPub Independent maintainer , Fans all over the Internet 15w+,csdn Blogger 、java Quality creators in the field ,51ctoTOP10 Blogger , You know / Nuggets / Hua Wei Yun / Alibaba cloud /InfoQ And other high-quality authors 、 Focus on Java Technical fields and sidelines .


official account :JavaPub The resume template 、 Learning materials 、 The interview question bank is for you


Official account 【JavaPub】, reply : Minimum necessary interview questions , obtain 《10 swastika 301 Avenue Java Summary of classic interview questions ( Answer attached )》pdf, Easier to recite questions , One article in hand , I have

Surprise interview | Surprise interview | Surprise interview

《 Reptiles 119》 Fire fighting tutorial

request

install request

pip install requests

Guide pack

# Python
import requests

Crawl start

import requests
res = requests.get("https://www.baidu.com")
print(res.text)

Set request header


import requests
head = {

"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36"
}
res = requests.get("https://www.baidu.com", headers=head)
print(res.text)
print(res.status_code)

GitHub | Gitee


The source code for :

everyone give the thumbs-up 、 Collection 、 Focus on 、 Comment on La 、 see WeChat Get contact information through official account


Clock in article to update 1 / 365 God


Wonderful column recommended subscription : In the column below


《 Reptiles 119》 Fire fighting tutorial


《 Common secrets of reptiles 》

Official account , reply 1024, obtain Java Learning route mind map 、 Join the reptile program learning community

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved