5
dictをjsonファイルにダンプする方法は?
私はこのような口述を持っています: sample = {'ObjectInterpolator': 1629, 'PointInterpolator': 1675, 'RectangleInterpolator': 2042} json以下に示すように、dictをファイルにダンプする方法がわかりません。 { "name": "interpolator", "children": [ {"name": "ObjectInterpolator", "size": 1629}, {"name": "PointInterpolator", "size": 1675}, {"name": "RectangleInterpolator", "size": 2042} ] } これを行うためのPython的な方法はありますか? 私はd3ツリーマップを生成したいと思うかもしれません。
239
python
json
dictionary