TypeError: Python中应为字符串或缓冲区

TypeError:应为字符串或缓冲区

from BeautifulSoup import BeautifulSoup
import urllib2
import re
html_page = urllib2.urlopen("http://kteq.in/services")
soup = BeautifulSoup(html_page)
for link in soup.findAll('a'):
   result = re.sub(r"http\S+", "", link.get('href'))
   print result
   print "____________________________________________________"

当我运行上面的代码时,它在第7行显示TypeError。无法纠正错误。请推荐我。

转载请注明出处:http://www.xingnongyuan.com/article/20230526/2493088.html