小编Aur*_*ger的帖子

打印列表值的字典

我有一个字典值列表,如下所示:

{'ID 2': [{'game': 586, 'start': 1436882375, 'process': 13140}, {'game': 585, 'start': 1436882375, 'process': 13116}], 'ID 1': [{'game': 582, 'start': 1436882375, 'process': 13094}, {'game': 583, 'start': 1436882375, 'process': 12934}, {'game': 584, 'start': 1436882375, 'process': 12805}]}
Run Code Online (Sandbox Code Playgroud)

它几乎不可读.我想这样格式化:

'ID 2' : {'game': 586, 'start': 1436882375, 'process': 13140},
'ID 2' : {'game': 585, 'start': 1436882375, 'process': 13116},
'ID 1' : {'game': 582, 'start': 1436882375, 'process': 13094},
'ID 1' : {'game': 582, 'start': 1436882375, 'process': 13094},
Run Code Online (Sandbox Code Playgroud)

我的打印代码如下:

 for key in queue_dict.items():
        for values in …
Run Code Online (Sandbox Code Playgroud)

python dictionary list python-3.x

2
推荐指数
1
解决办法
5499
查看次数

标签 统计

dictionary ×1

list ×1

python ×1

python-3.x ×1