写入excel数据报错:ValueError: Cannot convert {'code': 0, 'msg': 'login success!', 'username': 'test',} to Excel

今天在把测试结果以json格式写回excel表格中的时候报错,ValueError: Cannot convert {'code': 0, 'msg': 'login success!', 'username': 'test',} to Excel,无法转换到excel

产生原因:excel只支持字符串格式存入,不支持json格式的数据。

解决:str强制转换成字符串存入:

猜你喜欢

转载自www.cnblogs.com/xiamaojjie/p/12148163.html