python 响应不包括所有 html

问题描述 投票:0回答:0

我尝试通过 python 接收 html 响应。问题是我从 python 获得的响应中不存在 html 的某些部分(我需要的部分)。而当我在浏览器的开发人员模式下控制 html 代码时,我看到了它们。有人可以帮助我吗?

这是我使用的代码:

import mechanize
from bs4 import BeautifulSoup
import xml.etree.ElementTree as ET
from urllib.request import urlopen
import ssl
br = mechanize.Browser()
br.open('https://www.giustizia.it/giustizia/it/mg_form_view.wp?uid=G_MAP')

br.form = list(br.forms())[2]

br['cerca_comune'] = 'lecco'
br['_xml_'] = ['xml']
response=br.submit()
soup = BeautifulSoup(response, "html.parser")

这是 python 响应中缺少的部分。

html xml forms web-scraping webbrowser-control
© www.soinside.com 2019 - 2024. All rights reserved.