From PHP guides to small marketing. From ePayments all the way through to BioTech. Your all-tech passport.
Jun 21, 2012
Python downloader script using urllib tutorial
Hey hey, last few days i was learning python, an awesome scripting(programing) language and i must say that python it's amaizing xDD.
If you ever waned to download a page for example without viewing it "for security reasons" python does just that!
To make a python download script first of all we will import UrlLib, a python module, then read the url:
Note! I used python 2.7 for this tutorial, for v3 you need to make some edits.
import urllib // the module
url = urlib.urlopen(“http://google.com/”).read() // read from google
path = open(r“C:\google.html”, “w”) // google.html will be saved on C:\
path.write(url) // write url data to path
path.close() // then close path
Simple and working example & dont forget to share xDD
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment