html = """<h1 class='td p1'> 0000000000000000000000000 </h1> <h1 class='td p2'> 123333333333333333333 </h1> <h1 class='p2'> 111111111111111111111111111111111111 </h1>""" soup = BeautifulSoup(html, "lxml") content = soup.find('h1', attrs={'class':'td p1'})
>>> print(content) <h1 class="td p1">
0000000000000000000000000
</h1>
标签:python,0000000000000000000000000,content,soup,html,class From: https://www.cnblogs.com/lewisat/p/17837154.html