我正在尝试导入email_extractor但在第一个 except 语句上出现错误,除了 urllib2.URLError
,详细信息:
编辑该行时的 PyCharm 消息说:
"Python 3.6 does not support this syntax"
请问我该如何解决这个问题?
def getPage(url):
try:
f = urllib2.urlopen(url)
page = ""
for i in f.readlines():
page += i
date = f.info().getdate('Last-Modified')
if date == None:
date = (0, 0, 0)
else:
date = date[:3]
f.close()
return (page, date, f.url)
except urllib2.URLError, detail:
pass
return (None, (0,0,0), "")
这只是except
块的错误语法,它应该带有括号:
except (urllib2.URLError, detail):
pass
return (None, (0,0,0), "")