【发布时间】:2019-12-18 15:02:29
【问题描述】:
我正在尝试从“个人资料”汤中去除所有 HTML 标签,我无法执行“.text.strip()”操作,因为它是一个列表,如下面的代码所示
import requests
from bs4 import BeautifulSoup
from pprint import pprint
page = requests.get("https://web.archive.org/web/20121007172955/http://www.nga.gov/collection/anZ1.htm").text
soup = BeautifulSoup(company_page, "html.parser")
info = {}
info['Profile'] = soup.select('div.text-desc-members')
pprint(info)
【问题讨论】:
-
无法执行“.text.strip()”操作,因为它是一个列表问题解决了,不是吗?
标签: python html python-3.x web-scraping beautifulsoup