import requests #导入requests包 from bs4 import BeautifulSoup url='http://www.cntour.cn/' strhtml=requests.get(url) content = strhtml.text print(content) print("============") soup = BeautifulSoup(content,'lxml')#选择lxml作为解析器 print(soup.div['id']) print(soup.title)