TypeError: 'encording' is an invalid keyword argument for this function
来源:13-7 正则分析HTML

excvavtor
2018-06-26
from urllib import request
import re
class Spider():
url = 'https://www.panda.tv/'
# 使用组取两个定位标签中间的内容
root_pattern = '<div class="video-info">([\s\S]*?)</div>'
def __fetch_content(self):
r = request.urlopen(Spider.url)
htmls = r.read()
htmls = str(htmls, encording='utf-8') # 这句报错了 我的python版本是3.6
return htmls
def __analysis(self, htmls):
root_html = re.findall(Spider.root_pattern, htmls)
def go(self):
htmls = self.__fetch_content()
self.__analysis(htmls)
spider = Spider()
spider.go()
1回答
-
excvavtor
提问者
2018-06-26
encoding 关键字错了。。
00
相似问题