>>> from bs4 import BeautifulSoup >>> html = """ <html> <h1 align="center">This is heading 1</h1> </html> """ >>> soup = BeautifulSoup(html,'html.parser') >>> res = soup.find('h1').get_text() >>> print(res) This is heading 1 像这样吗?
像这样吗?