python爬虫 BeautifulSoup
导入库:import requestsfrom bs4 import BeautifulSoup获取html文件:def getHtml(url): res = requests.get(url,timeout=2,headers={'User-Agent':'Baiduspider'}) encode = res.encoding s=res.content s.decode(encode) return s生成实例: html = getHt