a guest May 19th, 2019 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- from bs4 import BeautifulSoup
- html_str = """
- <title>The Avengers</title>
- <p>The Avengers (2012)</p>
- <p>Avengers: Age of Ultron (2015)</p>
- <p>Avengers: Infinity War (2018)</p>
- <p>Avengers: Endgame (2019)</p>
- soup = BeautifulSoup(html_str)
- print(soup.select('html > body > p:nth-of-type(4)').text)
RAW Paste Data