Python 01 0

Extracting HTML Documents from Web Pages Using Python 05/05/11

Extracting HTML Documents from Web Pages Using Python: Question: Can you extract HTML documents from live web pages without even using an internet browser? Answer: Yes you can. All you need is a Python interpreter and these shortcommands: >>> ...


Extracting HTML Documents from Web Pages Using Python:
Question: Can you extract HTML documents from live web pages without even using an internet browser?
Answer: Yes you can. All you need is a Python interpreter and these shortcommands:

>>> import urllib
>>> sock = urllib.urlopen(“PAGE URL”)
>>> htmlSource = sock.read()
>>> sock.close()
>>> print htmlSource

Illustration (click to enlarge):

Python 01

Python 01

Python 02

Python 02

Related posts:


You can leave a response, or trackback from your own site.

Leave a Reply

close comment popup

Leave A Reply