我用wing101和python 3.3.2编写了以下内容
def open_page(url):
"""Open the URL string given and return its contents as file."""
page = None
increment_num_calls()
cont = False
while not cont:
try:
page = urllib2.urlopen(url)
cont = True
except urllib2.URLError as e:
print "Warning: Url load error " + str(e) + " for url " + url
#if not hasattr(e, "code"):
# raise
if hasattr(e, "code") and e.code == 401:
return None
time.sleep(TIME_DELAY_PAGE_RETRY)
return None
except httplib.BadStatusLine:
return None
return page
谁能帮我找出错误所说的错误
print "Warning: Url load error " + str(e) + " for url " + url
如果你想看更多的节目让我知道,我可以发布它。