Skip to content

Instantly share code, notes, and snippets.

@cpcloud
Last active December 18, 2015 00:19
Show Gist options
  • Save cpcloud/5695835 to your computer and use it in GitHub Desktop.
Save cpcloud/5695835 to your computer and use it in GitHub Desktop.
test bs4 + lxml
from lxml.html import parse
url = 'http://www.fdic.gov/bank/individual/failed/banklist.html'
doc = parse(url)
print len(doc.xpath('.//table')) > 0
from bs4 import BeautifulSoup
from contextlib import closing
from urllib2 import urlopen
with closing(urlopen(url)) as f:
soup = BeautifulSoup(f.read(), features='lxml')
print len(soup.find_all('table')) > 0
@cpcloud
Copy link
Author

cpcloud commented Jun 3, 2013

FINALLY i can repro this when using anaconda...

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