这是我的代码的一部分:
import urllib2
def find_all(list1):
for link1 in list1:
p1 = urllib2.urlopen(link1)
s1 = p1.read()
s2 = s1.find('"ratingValue"')
start_char = s1.find('>', s2)
.......
m = 'http://www.tervisetrend.ee/hambaarst-Aleksei-Ratsep-MD18661.aspx'
lm = list(m)
find_all(lm)
当我运行它时,我有以下错误:
Traceback (most recent call last):
File "/home/mike/Downloads/link_code.py", line 70, in <module>
find_all(lm)
File "/home/mike/Downloads/link_code.py", line 40, in find_all
p1 = urllib2.urlopen(link1)
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 396, in open
protocol = req.get_type()
File "/usr/lib/python2.7/urllib2.py", line 258, in get_type
raise ValueError, "unknown url type: %s" % self.__original
ValueError: unknown url type: h
为什么我会出现此错误,我该如何解决?
注意:我已经运行了很多次,之前它没有给我一个错误。
谢谢。