pprint整洁打印 分类: python Module 2014-01-03 16:40 235人阅读 评论(0) 收藏
>>> 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')