Skip to content

Instantly share code, notes, and snippets.

Created August 20, 2021 08:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
import csv
from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen("")
soup = BeautifulSoup(html, "html.parser")
table = soup.findAll("table", {"class":"wikitable"})[0]
rows = table.findAll("tr")
with open("Dataset.csv", "wt+", newline="") as f:
writer = csv.writer(f)
for i in rows:
row = []
for cell in i.findAll(["td", "th"]):
import pandas as pd
data = pd.read_csv("Dataset.csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment