a bytes-like object is required, not 'str'报错改正

运行命令

import urllib.request
ge_csv = urllib.request.urlopen(url)
data = []
for line in ge_csv:
data.append(line.split(','.encode(encoding="utf-8")))
data

出现报错
a bytes-like object is required, not 'str'

改成
data.append(line.split(','.encode(encoding="utf-8")))

你可能感兴趣的:(a bytes-like object is required, not 'str'报错改正)