无法连接python中的任何URL

时间:2017-11-28 11:34:44

标签: python http

获得以下错误

<urlopen error [Errno 101] Network is unreachable>

以下是我的代码

#!/usr/bin/python
# -*- coding: utf-8 -*-
from urllib2 import Request, urlopen, URLError
request = Request('http://google.com/')
try:
    response = urlopen(request)
    kittens = response.read()
    print kittens[559:1000] 
except URLError, e:
    print 'No kittez. Got an error code:', e

0 个答案:

没有答案