运维网's Archiver
论坛
›
Python
› python BeautifulSoup获取网页正文
zj2092
发表于 2018-8-12 10:56:24
python BeautifulSoup获取网页正文
#!/usr/bin/env python
#coding=utf-8
#HTML找出正文
import requests
from bs4 import BeautifulSoup
url='http://www.baidu.com'
html=requests.get(url)
soup=BeautifulSoup(html.text)
print soup.get_text()
页:
[1]
查看完整版本:
python BeautifulSoup获取网页正文