Python爬虫基本步骤 import requests ### 爬虫 # 获取url url = "https://www.baidu.com/" # 发送请求 后会返回一个response对象 response = requests.get(url) response.encoding = 'utf-8' # 获取response中被响应的数据 # status_code 状态码 print(response.status_code) # encoding 是编码格式 print(response.encoding) # text 是html文本 print(response.text)