with open(output_file_path_final, 'w') as f:
json.dump(final, f, separators=(',', ':'))
这是我的 python 代码的关键行,我得到的输出如下,
{"frame.number":[80.0,87.0,93.0,95.0,99.0,....],"frame.timestamp [s]":[1324055659.394, 1324055659.488, 1324055659.607, 1324055659.613, 1324055659.695,.....], ......... "{31} EVSE Maximum Power Limit [W]":[null, null, null, null, null, null,....]}
separators=(',\n', ':'))
:这个解决方案不起作用,因为它在新行中给出了每个参数。
{"frame.number":[80.0, 87.0, 93.0, 95.0, 99.0, 103.0, 106.0,.......],
"frame.timestamp [s]":[1324055659.394, 1324055659.488, 1324055659.607, 1324055659.613, 1324055659.695,.....],
.
.
.
.
"{31} EVSE Maximum Power Limit [W]":[null, null, null, null, null, null,....]
}