自动补全代码:
import requests from bs4 import BeautifulSoup response=requests.get(‘https://www.ithome.com/html/it/340684.htm‘,timeout=9) result=response.text soup=BeautifulSoup(response.content,‘lxml‘) print(soup.prettify())#如果html代码补全,则自动补全 print(soup.title.string)
查找标签
#基本使用 soup.title#<title>xxxxxxx</title> soup.title.string#xxxxxx