File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 1- # To run this, you can install BeautifulSoup
1+ # To run this, you can install BeautifulSoup
22# https://pypi.python.org/pypi/beautifulsoup4
33
44# Or download the file
1212html = urlopen (url ).read ()
1313
1414# html.parser is the HTML parser included in the standard Python 3 library.
15- # information on other HTML parsers is here:
16- #http://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser
15+ # information on other HTML parsers is here:
16+ # http://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser
1717soup = BeautifulSoup (html , "html.parser" )
1818
1919# Retrieve all of the anchor tags
2020tags = soup ('a' )
2121for tag in tags :
2222 # Look at the parts of a tag
23- print ('TAG:' ,tag )
24- print ('URL:' ,tag .get ('href' , None ))
25- print ('Contents:' ,tag .contents [0 ])
26- print ('Attrs:' ,tag .attrs )
23+ print ('TAG:' , tag )
24+ print ('URL:' , tag .get ('href' , None ))
25+ print ('Contents:' , tag .contents [0 ])
26+ print ('Attrs:' , tag .attrs )
You can’t perform that action at this time.
0 commit comments