Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在python中获取url_Python_Python 2.7_Urllib2 - Fatal编程技术网

无法在python中获取url

无法在python中获取url,python,python-2.7,urllib2,Python,Python 2.7,Urllib2,我无法从biblegateway.com获取url,此处显示错误为 urllib2.URLError:请不要重复,因为我浏览了重复显示的站点,但访问该站点时我不理解这些站点 这是我的密码 import urllib2 url = 'https://www.biblegateway.com/passage/?search=Deuteronomy+1&version=NIV' response = urllib2.urlopen(url) html = response.read() pri

我无法从biblegateway.com获取url,此处显示错误为 urllib2.URLError:请不要重复,因为我浏览了重复显示的站点,但访问该站点时我不理解这些站点

这是我的密码

import urllib2
url = 'https://www.biblegateway.com/passage/?search=Deuteronomy+1&version=NIV'
response = urllib2.urlopen(url)
html = response.read()
print html

这里是一个很好的参考

在python 3中,您可以有:

from urllib.request import urlopen
URL = 'https://www.biblegateway.com/passage/?search=Deuteronomy+1&version=NIV'
f = urlopen(URL)
myfile = f.read()
print(myfile)

但不确定它是否清除了ssl问题。也许有一些线索。

哪条python?与python 2.7@dave_thompson_085相比,我正在使用python 2.7@dave_thompson_085其显示的AttributeError的可能重复:“module”对象没有属性“request”@EvgenyAr是否在python 3中运行它?它现在通过在3.6中通过import urllib.request@Evgenyright重放import urllib工作。它是否绕过了ssl错误?而且,它比urllib更简单、更高级