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 short commands:
>>> import urllib
>>> sock = urllib.urlopen("PAGE URL")
>>> htmlSource = sock.read()
>>> sock.close()
>>> print htmlSource
Illustration (click to enlarge):
Python Related Posts:
* Will Real Python Hackers Please Stand Up
* How to Rescue Windows Files Using Linux and Python
* Highly Recommended Books on Python
No comments
Post a Comment