#获取html defgetHtml(): url = 'https://zjqian.github.io/tags/index.html' res = requests.get(url) return res.text #通过BeautifulSoup解析网页,得到标签 defgetContent(): soup = BeautifulSoup(getHtml(),'lxml') text = '' for item in soup.find('div', class_='tag-cloud-tags'): text += item.string return text