运行程序时出现下面的错误:
TypeError: write() argument must be str, not bytes
其实是文件打开的问题,而且默认的储存方式是二进制
原始程序是:
with open(result_file, 'w') as f:
将其改成下面的就对了
with open(result_file, 'wb+') as f:
运行程序时出现下面的错误:
TypeError: write() argument must be str, not bytes
原始程序是:
with open(result_file, 'w') as f:
将其改成下面的就对了
with open(result_file, 'wb+') as f: