Skip to content Skip to sidebar Skip to footer

How To Get Html Tags From Url?

How would you get all the HTML tags from a URL and print them?

Solution 1:

import urllib
print urllib.urlopen('http://www.example.com/blah').read()

Solution 2:

Fetch it (using mechanize, urllib or whatever else you want), parse what you get (using elementtree, BeautifulSoup, lxml or whatever else you want) and you have what you want.


Post a Comment for "How To Get Html Tags From Url?"