首页 > TAG信息列表 > rqq
解析网页的多种方式
1.使用正则表达式获取网页标题内容 In [ ]: import requests import re url = 'http://www.tipdm.com/tipdm/index.html' rqq = requests.get(url) rqq.encoding = 'utf-8' rqq.text In [ ]: re.findall('<li><a href="[a-z0-9.:/]+" target=使用requests库实现http请求
1.发送请求 import requests url = 'http://www.tipdm.com/tipdm/index.html' rqq = requests.get(url) In [ ]: print('响应码:', rqq.status_code) print('编码:', rqq.encoding) print('请求头:', rqq.headers) # print('实体:', r