On Tue, 01 Jul 2008 15:16:03 +0800, oyster wrote: > currently I am using > [code] > req=urllib2.Request(url) > data='' > if '</htm>' not in data: > fd=urllib2.urlopen(req) > data=fd.read() > time.sleep(10) > time.sleep(10) > blahblah > [/code]
That looks very strange. Why the ``if`` and the `sleep()`\s? The ``if`` condition is always true, so it's completely unnecessary. The `read()` call is blocking, that means it returns iff the complete data is read. So there's no need to wait or to check if all is read. If there's a problem with the connection an exception should be raised by `urllib2`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list