How would you get all the HTML
tags from a URL
and print them?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
import urllib
print urllib.urlopen('http://www.example.com/blah').read()
回答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.