#code for printing all the link from website using beautifulsoup4
import urllib2
from bs4 import BeautifulSoup
#import webbrowser
redditFile = urllib2.urlopen("http://www.oceanwebtech.com")
redditHtml = redditFile.read()
redditFile.close()
soup = BeautifulSoup(redditHtml)
redditAll = soup.find_all("a")
for links in soup.find_all('a'):
print (links.get('href'))
#webbrowser.open(links.get('href'))#for opening all the links
No comments:
Post a Comment