Demo entry 6796542



Submitted by anonymous on May 15, 2019 at 14:12
Language: Python 3. Code size: 968 Bytes.

import requests
from bs4 import BeautifulSoup
import pandas as pd

prefix = ""
webpage_response = requests.get('')

webpage = webpage_response.content
soup = BeautifulSoup(webpage, "html.parser")

turtle_links = soup.find_all("a")
links = []
#go through all of the a tags and get the links associated with them"
for a in turtle_links:
#Define turtle_data:
turtle_data = {}

#follow each link:
for link in links:
  webpage = requests.get(link)
  turtle = BeautifulSoup(webpage.content, "html.parser")
  turtle_name =".name")[0].get_text()
  stats = turtle.find("ul")
  stats_text = stats.get_text("|")
  turtle_data[turtle_name] = stats_text.split("|")

turtle_df = pd.DataFrame.from_dict(turtle_data, orient='index')

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).