Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- URL_QS = 'https://en.wikipedia.org/wiki/Kazakhstan'
- r = requests.get(URL_QS)
- soup = BeautifulSoup(r.text, 'lxml')
- # Only keep the infobox (top right)
- infobox = soup.find("table", class_="infobox geography vcard")
- if infobox:
- formation = infobox.find_next(text = re.compile("Formation"))
- if formation:
- independence = formation.find_next(text = re.compile("independence"))
- if independence:
- independ_date = independence.find_next("td").text
- else:
- independence = formation.find_next(text = re.compile("Independence"))
- if independence:
- independ_date = independence.find_next("td").text
- print(independ_date)
- Almaty
Add Comment
Please, Sign In to add comment