使用语句:
with open(text_filename,'wb') as myfile:
json.dump({'weights': \weights.tolist()}, myfile)报错:
TypeError: a bytes-like object is required, not 'str'我修改'wb'为‘w'
with open(text_filename,'w') as myfile:
json.dump({'weights': \weights.tolist()}, myfile)成功运行。
版权声明:本文为q6978541原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。