python爬虫初步认知
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)
一切技术都是为业务服务,脱离业务的技术一文不值!