import requests from bs4 import BeautifulSoup def getContent(): url = "https://baike.so.com/doc/2276866-2408683.html" req_url = requests.get(url) req_url.encoding='utf-8' #中文转换 req_html = req_url.text bs_obj = BeautifulSoup(req_html) texts = bs_obj.find_all("div", class_="card_content") print(texts) if __name__ == "__main__": getContent()