import urllibpagehandler = urllib.urlopen("http://www.google.com")outputfile = open("index.html", "wb")while 1: data = pagehandler.read(512) if not data: break outputfile.write(data)outputfile.close()pagehandler.close()