Skip to content

Instantly share code, notes, and snippets.

@jerielizabeth
Created November 27, 2012 02:32
Show Gist options
  • Save jerielizabeth/4152029 to your computer and use it in GitHub Desktop.
Save jerielizabeth/4152029 to your computer and use it in GitHub Desktop.
Script, part 1
from bs4 import BeautifulSoup
import csv
soup = BeautifulSoup (open("43rd-congress.html"))
final_link = soup.p.a
final_link.decompose()
links = soup.find_all('a')
for link in links:
names = link.contents[0]
fullLink = link.get('href')
f = csv.writer(open("43rd_Congress.csv", "a"))
f.writerow([names, fullLink])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment