回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我已经编写了一个python脚本,它应该通过读取json文件来形成csv。json文件实际上是一行json,<em>即,</em>每行代表一个json对象。在我的json文件中,每一行都有一个键和一个值。我需要读取值并从中生成csv。示例json文件是:</p>
<pre><code>{"30b26e96052f7e4cda0fe2eff99d128ab2689cfee8637c0f50e540fae811c1b9": "{\"0\": \"440899\", \"1\": \"440900\", \"-1\": \"440898\"}"}
{"669b10aa7c547109650e12f9904152e74c52d55c0a6d6c66fe1ea7b0b37a4ba7": "{\"0\": \"440900\", \"1\": \"440901\", \"-1\": \"440899\"}"}
{"1e13e07b8484e730997fbe516f1e0adf94729dbb30c2e92dfbdb9839c6e4e434": "{\"0\": \"440901\", \"1\": \"440902\", \"-1\": \"440900\"}"}
</code></pre>
<p>现在,我的代码是:</p>
^{pr2}$
<p>我要找的输出是</p>
<p><code>{\"0\": \"440899\", \"1\": \"440900\", \"-1\": \"440898\"}</code></p>
<p>这意味着我要读取值,值本身是json格式的,其中有键、值对。我的目标是在csv文件中编写这样的json,比如:</p>
<pre><code>0,1,-1
440899, 440900, 440898
..., ..., ...
</code></pre>
<p>我现在得到的完全是令人困惑的:</p>
<pre><code>{'1e13e07b8484e730997fbe516f1e0adf94729dbb30c2e92dfbdb9839c6e4e434': nan, '30b26e96052f7e4cda0fe2eff99d128ab2689cfee8637c0f50e540fae811c1b9': '{"0": "440899", "1": "440900", "-1": "440898"}', '3533a5d915469b16e04c10587c1a56ff5b0a6e16e2de3ae9873ad0e5b772c10c': nan, '573a0044e9315d4d598019f8bde1ceb93eed42f6c078f2cf9769e9c7a53fd9b6': nan, '669b10aa7c547109650e12f9904152e74c52d55c0a6d6c66fe1ea7b0b37a4ba7': nan, 'a5d172be131b5ff72d621a845f5d501d5d78352a3d52b8a86af88912824d4bd9': nan, 'e41d5c4ca5ae85908cac2d8a665d1292ba6a6f98dd720651300ea9f893fb53ae': nan, 'f825fbd436b2533dc3473cda15c304c9c79a108d2e59d18ec54fc9706966536b': nan}
{'1e13e07b8484e730997fbe516f1e0adf94729dbb30c2e92dfbdb9839c6e4e434': nan, '30b26e96052f7e4cda0fe2eff99d128ab2689cfee8637c0f50e540fae811c1b9': nan, '3533a5d915469b16e04c10587c1a56ff5b0a6e16e2de3ae9873ad0e5b772c10c': nan, '573a0044e9315d4d598019f8bde1ceb93eed42f6c078f2cf9769e9c7a53fd9b6': nan, '669b10aa7c547109650e12f9904152e74c52d55c0a6d6c66fe1ea7b0b37a4ba7': '{"0": "440900", "1": "440901", "-1": "440899"}', 'a5d172be131b5ff72d621a845f5d501d5d78352a3d52b8a86af88912824d4bd9': nan, 'e41d5c4ca5ae85908cac2d8a665d1292ba6a6f98dd720651300ea9f893fb53ae': nan, 'f825fbd436b2533dc3473cda15c304c9c79a108d2e59d18ec54fc9706966536b': nan}
</code></pre>