import csv
csvfile = open("data/user_log.csv", "r")
报错:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 135: illegal multibyte sequence
改为:
csvfile = open("data/user_log.csv", "r", encoding="utf8")
参数encoding:
encoding is the name of the encoding used to decode or encode the
file. This should only be used in text mode. The default encoding is
platform dependent, but any encoding supported by Python can be
passed. See the codecs module for the list of supported encodings.
通过encoding参数指定编码