【发布时间】:2016-10-09 21:01:08
【问题描述】:
import urllib.request
import re
f = urllib.request.urlopen('http://www.geekynu.cn/')
html = f.read()
title = re.search('<title>(.*?)</title>', html)
print(title)
#print(title.decode('utf-8')) //I had try to solve by this code.
[python 3.5] 当我使用re.search()阅读网页标题时,出现“TypeError: cannot use a string pattern on a bytes-like object”的错误,我该怎么办?谢了!
【问题讨论】:
标签: python python-3.x