Python通过一个网页地址获得网页标题Title

import requests
from bs4 import BeautifulSoup
res = requests.get("https://www.51dev.com")
res.encoding = 'utf-8'  # 
soup = BeautifulSoup(res.text, 'lxml')
print(soup.title.text)

 

你可能感兴趣的