首页 > 编程 > Python > 正文

Python学习笔记 --- pprint模块

2019-11-08 19:40:30
字体:
来源:转载
供稿:网友

使用 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')
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表