Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bs4 import BeautifulSoup as BS
- html="""
- <html>
- <head>
- </head>
- <body>
- <h1 id="heading">This is H1 with id = heading</h1>
- </body>
- </html>
- """
- soup = BS(html,"html.parser")
- print(soup.find_all("h1")[0].text) # Output: This is H1 with id = heading
- print(soup.find_element_by_id("heading")) # TypeError: 'NoneType' object is not callable
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement