python 字典打印好看
时间: 2023-08-28 20:05:50 浏览: 162
回答: 如果你想要以更美观、简洁的方式打印Python字典,你可以使用pprint模块。首先,你需要导入pprint模块,可以使用以下代码实现:`from pprint import pprint`。接下来,你可以加载字典数据并将其转换为一个有序字典,例如使用`data = np.load('result/data.npy', allow_pickle=True)`和`dict = edict(data.item())`。最后,你可以使用pprint函数来打印字典,例如`pprint(dict)`。这样,你就可以以更美观、简洁的方式打印Python字典了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [【Python】pprint可以让你的字典打印信息更加美观](https://blog.csdn.net/gschen_cn/article/details/126604543)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [python菜鸟教程字典-Python 字典(Dictionary) | 菜鸟教程](https://blog.csdn.net/weixin_37988176/article/details/109413318)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文