Python学习笔记 --- pprint模块

来源:互联网 发布:bootstrap 可视化编程 编辑:程序博客网 时间:2024/06/08 10:57

使用 pprint 模块

pprint 模块( pretty printer )

用于打印 Python 数据结构. 当你在命令行下打印特定数据结构时你会发现它很有用(输出格式比较整齐, 便于阅读).


import pprintdata = (    "this is a string", [1, 2, 3, 4], ("more tuples",    1.0, 2.3, 4.5), "this is yet another string"    )pprint.pprint(data)



('this is a string',
[1, 2, 3, 4],
('more tuples', 1.0, 2.3, 4.5),
'this is yet another string')

0 0
原创粉丝点击