我正在尝试从我的学校网站获取课程数据并将其解析为.json文件。我坚持输入代码:
import urllib.request
with urllib.request.urlopen('https://catalogue.ualberta.ca/') as response:
html = response.read()
decoded = html.decode('ascii')
当我运行它时,它给了我
'ASCII' codec can't decode byte 0xc2 in position 32817: ordinal not in range(128)
我该如何解决这个问题?
答案 0 :(得分:1)
decoded = html.decode('utf-8')