>>> import pprint
>>> pprint.pprint(data)
('this is a string',
[1, 2, 3, 4],
('more tuples', 1.0, 2.3, 4.5),
'this is yet another string')
>>> print(data)
('this is a string', [1, 2, 3, 4], ('more tuples', 1.0, 2.3, 4.5), 'this is yet another string')
>>> pp = pprint.PrettyPrinter(indent=4) #缩进4空格
>>> pp.pprint(data)
( 'this is a string',
[1, 2, 3, 4],
('more tuples', 1.0, 2.3, 4.5),
'this is yet another string')
pprint整洁打印
最新推荐文章于 2023-12-10 16:04:22 发布