quickly recover HTML code of several URL?
Jack
nonmerci at ok.com
Fri Aug 16 15:12:23 EDT 2002
I want simultaneously to recover HTML code of a list of URL. (tread,
threading modules ?)
and write the result in a file (use mutex ?).
Can someone modify my code, or help me ?
thanks
---
import urllib
URLs =
["http://www.google.com","http://www.debian.org","http://www.python.org"]
def getHtmlSource(url):
htmlSource = urllib.urlopen(url).read()
fichier = open('test.txt', 'a')
fichier.write(htmlSource)
fichier.close()
for url in URLs:
getHtmlSource(url)
More information about the Python-list
mailing list