import urllib.request
html=urllib.request.urlopen("http://v.liangle.com/nba").read()
decodedHtml=html.decode('utf-8')
##完成
import requests
resp=urllib.get("http://v.liangle.com/nba")
resp.encoding='utf-8'
decodedHtml=resp.text
##完成
报错哪一行改成这样
html.encoding = 'utf8'
不用decode,直接BeautifulSoup
这里获取 html 以后直接
soup = BeautifulSoup(html.content, 'lxml') # 不要使用 text 由 BS4 自动处理编码