sudo easy_install BeautifulSoup
from BeautifulSoup import BeautifulSoup
content = ''.join(BeautifulSoup("<htlm>xxxxx</html>").findAll(text=True))
本文介绍了一种利用Python中的BeautifulSoup库从HTML文档中提取纯文本的方法。通过使用sudoeasy_install命令安装BeautifulSoup,并导入该库,可以方便地解析HTML内容并获取所需的文字信息。
sudo easy_install BeautifulSoup
from BeautifulSoup import BeautifulSoup
content = ''.join(BeautifulSoup("<htlm>xxxxx</html>").findAll(text=True))
498

被折叠的 条评论
为什么被折叠?