【发布时间】:2014-06-24 14:52:58
【问题描述】:
我想构建一个网络爬虫。目前,我正在学习 Python。这是最基本的!
Python 代码
import urllib.request
import re
htmlfile = urllib.request.urlopen("http://basketball.realgm.com/")
htmltext = htmlfile.read()
title = re.findall('<title>(.*)</title>', htmltext)
print (htmltext)
错误:
File "C:\Python33\lib\re.py", line 201, in findall
return _compile(pattern, flags).findall(string)
TypeError: can't use a string pattern on a bytes-like object
【问题讨论】:
标签: python-3.x web-scraping scraper findall