是否有与Perl的Data :: Dumper等效的Python用于检查数据结构?
问题描述:
Is there a Python module that can be used in the same way as Perl's Data::Dumper
module?
编辑:抱歉,我应该更清楚一些.我主要是在检查数据而不是持久性的模块之后.
Sorry, I should have been clearer. I was mainly after a module for inspecting data rather than persisting.
顺便说一句,谢谢您的回答.这是一个很棒的网站!
BTW Thanks for the answers. This is one awesome site!
答
Data :: Dumper有两个主要用途:数据持久性和调试/检查对象.据我所知,没有什么能与Data :: Dumper完全一样的工作.
Data::Dumper has two main uses: data persistence and debugging/inspecting objects. As far as I know, there isn't anything that's going to work exactly the same as Data::Dumper.
我将 pickle 用于数据持久性.
我使用 pprint 直观地检查我的对象/调试.
I use pprint to visually inspect my objects / debug.