Created
July 19, 2016 06:47
-
-
Save pbamotra/65e349ef1121c386ba8286df8e4b327d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup as BS | |
from bs4 import Comment | |
import urllib2 | |
from BeautifulSoup import BeautifulSoup | |
page = urllib2.urlopen("http://cs231n.stanford.edu/syllabus.html") | |
soup = BS(page,'html.parser') | |
comments=soup.find_all(string=lambda text:isinstance(text,Comment)) | |
for comment in comments: | |
comment_soup = BS(comment,'html.parser') | |
for link in comment_soup.find_all('a'): | |
print link.get('href') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment