我正在使用 pymongo 驱动程序来使用 Python 与 Mongodb 一起工作。每次我在 python shell 中运行查询时,它都会返回一些很难理解的输出。我在 mongo shell 中使用了 .pretty()
选项,它以结构化的方式提供输出。
我想知道pymongo中是否有类似pretty()
的方法,可以结构化的返回输出?
最佳答案
I want to know whether there is any method like
pretty()
in PyMongo
否 PyMongo 不提供这种方法。它仅在 shell 中可用。
您需要使用 pprint
来自 pprint
的函数模块。
关于mongodb - 在 pymongo 中漂亮地打印输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34493535/