Object of type 'ndarray' is not JSON serializable
import numpy as np
import json
arr=np.asarray([345,45])
result={'name':'test','num':ar}
json.dump(result)
解决方法:
result={'name':'text','num':ar.tolist()}
json不认numpy的array
Object of type 'ndarray' is not JSON serializable
import numpy as np
import json
arr=np.asarray([345,45])
result={'name':'test','num':ar}
json.dump(result)
解决方法:
result={'name':'text','num':ar.tolist()}
json不认numpy的array
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。