pymongo 中输出的漂亮打印 [英] Pretty printing of output in pymongo

查看:67
本文介绍了pymongo 中输出的漂亮打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 pymongo 驱动程序通过 Python 与 Mongodb 一起工作.每次我在 python shell 中运行查询时,它都会返回一些非常难以理解的输出.我在 mongo shell 中使用了 .pretty() 选项,它以结构化的方式提供输出.

I am using pymongo driver to work with Mongodb using Python. Every time when I run a query in python shell, it returns me some output which is very difficult to understand. I have used the .pretty() option with mongo shell, which gives the output in a structured way.

我想知道pymongo中是否有类似pretty()的方法,可以结构化的返回输出?

I want to know whether there is any method like pretty() in pymongo, which can return output in a structured way ?

推荐答案

我想知道PyMongo中有没有pretty()之类的方法

PyMongo 不提供这种方法.它仅在 shell 中可用.您需要使用 pprintpprint 模块中的函数.

No PyMongo doesn't provide such method. It is only available in the shell. You need to use the pprint function from the pprint module.

这篇关于pymongo 中输出的漂亮打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆