Python regular extraction of html title tag

Python regular extraction of html title tag 

import re
import requests        # 导入requests包
strhtml = requests.get('https://www.bilibili.com/video/av70290801?from=search&seid=8276641641400784929')        # Get方式获取网页数据
# print(strhtml.text)
print(re.findall(r"<title.*?>(.+?)</title>", strhtml.text))

 

Guess you like

Origin blog.csdn.net/chenhao0568/article/details/104882869