链接超时:time out
2018-07-14 本文已影响0人
蚂蚁的优雅
import urllib.request
try:
url='http://www.google.com'
url=urllib.request.urlopen(url,timeout=1)
url=url.read()
print(url)
except urllib.error.URLError as e:
print('出错了',str(e))
import urllib.request
try:
url='http://www.google.com'
url=urllib.request.urlopen(url,timeout=1)
url=url.read()
print(url)
except urllib.error.URLError as e:
print('出错了',str(e))