Rob*_*lls 40 python module object-dumper
是否有一个Python模块可以像Perl的Data::Dumper模块一样使用?
编辑:对不起,我应该更清楚了.我主要是在检查数据而不是持久化的模块之后.
BTW感谢您的回答.这是一个很棒的网站!
我认为最接近的是pprint模块。
>>> l = [1, 2, 3, 4]
>>> l.append(l)
>>> d = {1: l, 2: 'this is a string'}
>>> print d
{1: [1, 2, 3, 4, [...]], 2: 'this is a string'}
>>> pprint.pprint(d)
{1: [1, 2, 3, 4, <Recursion on list with id=47898714920216>],
2: 'this is a string'}
Run Code Online (Sandbox Code Playgroud)