Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- import requests
- from bs4 import BeautifulSoup
- latin_phrases_page = requests.get("https://en.wikipedia.org/wiki/List_of_Latin_phrases_(full)")
- latin_phrases_soup = BeautifulSoup(latin_phrases_page.text, "html.parser")
- rows = latin_phrases_soup.find_all("tr")
- for row in rows:
- cells = row.find_all("td", recursive=False)
- if len(cells) > 0:
- phrase = cells[0].find("b")
- if phrase is not None:
- chars = re.sub(r'[^a-z]+', '', phrase.text)
- words = phrase.text.split(" ")
- if len(chars) == 13 and len(words) == 4:
- print(phrase.text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement