用BeautifulSoup无法提取到被br分割开的信息,我该如何提取这些信息呢
# -*- coding = utf-8 -*-
import re
import requests
from bs4 import BeautifulSoup
import lxml
header = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36'}
url = "http://www.crpsz.com/zbxx/006001/006001001/20230725/a025dabc-b9ce-40e5-8d14-34fcb0cf1bc3.html"
page = requests.get(url, headers=header, timeout=5,
allow_redirects=False)
page.encoding = "utf-8"
soup = BeautifulSoup(page.text, 'html.parser')
contents = soup.find_all('span')
for content in contents:
content = str(content)
print(content)