使用语句:
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)
成功运行。