我正在使用 urllib2
try:
msmalvo = urllib2.urlopen(website)
except URLError as e:
msmalvo = e
if msmalvo.code == 200:
if msmalvo.read() == '<head>':
print 'Exits!'
else:
print 'Don't exist'
else:
print ' '
print msmalvo.code, ':/'
这个想法是确认在页面的源代码中找到了字符串“\head/”。我怎样才能做到这一点 ?