Python Beautifulsoup-删除HTML标记
我正在尝试从“profile”汤中去掉所有HTML标记,无论我是谁,都无法执行“.text.strip”操作,因为它是一个列表,如下面的代码所示Python Beautifulsoup-删除HTML标记,python,html,python-3.x,web-scraping,beautifulsoup,Python,Html,Python 3.x,Web Scraping,Beautifulsoup,我正在尝试从“profile”汤中去掉所有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
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)
只需反复浏览该列表:
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(page, "html.parser")
info = {}
info['Profile'] = soup.select('div.text-desc-members')
for item in info['Profile']:
pprint(item.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(page, "html.parser")
info = {}
info['Profile'] = soup.select('div.text-desc-members')
for item in info['Profile']:
pprint(item.text.strip())
无法执行“.text.strip”操作,因为它是当时解决的列表问题,否?无法执行“.text.strip”操作,因为它是当时解决的列表问题,否?你在@chitown88@αԋɱҽԃαєιcαη吗,嘿,怎么了?请随时给我发电子邮件,杰森。schvach@gmail.compay注意这个问题,你在吗?chitown88αԋɱҽαєιcαη,嘿,怎么了?请随时给我发电子邮件,杰森。schvach@gmail.compay请注意这个问题