您的位置:首页 > 编程语言 > Python开发

pprint整洁打印 分类: python Module 2014-01-03 16:40 235人阅读 评论(0) 收藏

2014-01-03 16:40 615 查看
>>> 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')
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐