Skip to content

Instantly share code, notes, and snippets.

@tommeagher
Created March 13, 2014 15:22
Show Gist options
  • Save tommeagher/9530488 to your computer and use it in GitHub Desktop.
Save tommeagher/9530488 to your computer and use it in GitHub Desktop.
Helping troubleshoot a scrape for PythonJournos
import urllib2
import csv
from BeautifulSoup import BeautifulSoup
url = "https://www.uif.uillinois.edu/simpledetail.aspx?id=91"
html = urllib2.urlopen(url).read()
soup = BeautifulSoup(html)
names = soup.find('ul', {'class':'people'})
names_table = names.findAll('li')
outfile = open('out.txt', 'a')
for name in names_table:
name = name.find('strong').text.strip()
if name:
outfile.write(name+'\n')
outfile.close()
@jayohday
Copy link

Beautiful. Works perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment