Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
REMitchell
GitHub Repository: REMitchell/python-crawling
Path: blob/master/1-HTML-Parsing/htmlParsing.py
164 views
1
from urllib.request import urlopen
2
from bs4 import BeautifulSoup
3
4
html = urlopen("http://www.oreilly.com/")
5
bsObj = BeautifulSoup(html,"lxml")
6
image = bsObj.find("img", {"alt":"O'Reilly Media, Inc."})
7
print(image.attrs['src'])
8