从网站上打印html后发现fieldset标签里的id属性和原网站上的属性不同,猜想可能是被js修改了这个id的值,试了很多办法都没有成功。主要是没办法获取被修改后的id的值
从图上可以看出,两者的id不同,请教大神,有什么办法能够获取被修改后的id的值吗?
全部代码贴在下面:
response = urllib.urlopen(url)
soup =BeautifulSoup(response,'lxml')
# text_que = soup.find_all('li',class_="QUES_LI")
print soup.prettify()
Unless you understand the rules for generating his ID, you cannot obtain it directly.
But there are many ways to get the modified value.
First, get the relevant elements first and then locate them. For example, you can get the parent element, then locate the child element and get its ID value.
Second, use regular matching to obtain. As long as the surrounding value of the changing value is fixed, there is a way to get it.
Excuse me, what website is this