[Pythonmac-SIG] on idle....idle()...and urllib
tom smith
tom@othermedia.com
Mon, 06 Nov 2000 12:56:24 +0000
This is the code I'm trying and it starts ok then seems to end up in a
permanent loop. Using urllib.read() hardly ever gets all the data....
import urllib
url1 = 'http://slashdot.org/slashdot.rdf'
url2 = 'http://hack-the-planet.felter.org/rss.xml'
url3 ='http://www.tomalak.org/recentTodaysLinks.xml'
url_list = [url1, url2, url3]
n =1
for x in url_list:
f = open(str(n), 'w')
u = urllib.urlopen(x)
data = ''
t = 0
while (u.readline()) != 0:
print u.readline()
data = data + u.readline()
t = t + 1
if t >10000:
break
print data
print
f.write(data)
f.close()
n =n +1