beeprint:让你的调试打印更友好

简介: beeprint:让你的调试打印更友好推荐一个国人的开源项目 beeprint,可以更加漂亮的打印你的调试信息。对标 Python 标准库的 pprint。下面我们就来看一下 beeprint 和 pprint 打印 Python 对象的对比。

beeprint:让你的调试打印更友好

推荐一个国人的开源项目 beeprint,可以更加漂亮的打印你的调试信息。对标 Python 标准库的 pprint。

下面我们就来看一下 beeprint 和 pprint 打印 Python 对象的对比。

打印字典对象

pprint

{'entities': {'hashtags': [],

          'urls': [{'display_url': 'tumblr.com/xnr37hf0yz',
                    'expanded_url': 'http://tumblr.com/xnr37hf0yz',
                    'indices': [107, 126],
                    'url': 'http://t.co/cCIWIwg'}],
          'user_mentions': []}}

beeprint

{
'entities': {

'hashtags': [],
'urls': [
  {
    'display_url': 'tumblr.com/xnr37hf0yz',
    'expanded_url': 'http://tumblr.com/xnr37hf0yz',
    'indices': [107, 126],
    'url': 'http://t.co/cCIWIwg',
  },
],
'user_mentions': [],

},
}
打印类对象

pprint


beeprint

class(NormalClassNewStyle):
dicts: {
},
lists: [],
static_props: 1,
tupl: (1, 2)
打印实例(instance)

pprint


beeprint

instance(NormalClassNewStyle):
dicts: {
},
lists: [],
say_hi: 'hello world',
static_props: 1,
tupl: (1, 2)
打印长文本

pprint

[['nThe sky and the earth were at first one blurred entity like an egg. Pangu was born into it.n ntThe separation of the sky and the earth took eighteen thousand years-the yang which was light and pure rose to become the sky, tand the yin which was heavy and murkyxefxbcx88xe6x9cxa6xe8x83xa7xe7x9ax84xefxbcx89 sank to form the earth. Between them was Pangu, who went through nine tchanges every day, his wisdom greater than that of the sky and his ability greater than that of the earth. Every day the sky rose ten feet higher, the earth became ten feet thicker, and Pangu grew ten feet taller.n nAnother eighteen thousand years passed, and there was an extremely high sky, an extremely thick earth, and an extremely tall Pangu. After Pangu died, his head turned into the Five Sacred Mountains (Mount Tai, Mount Heng, Mount Hua, Mount Heng, Mount Song), his eyes turned into the moon and the sun, his blood changed into water in river and sea, his hair into grass.n nIn all, the universe and Pangu combine in one.n',
'nxe6x8dxaexe6xb0x91xe9x97xb4xe7xa5x9exe8xafx9dxe4xbcxa0xe8xafxb4xe5x8fxa4xe6x97xb6xe7x9bx98xe5x8fxa4xe7x94x9fxe5x9cxa8xe9xbbx91xe6x9ax97xe5x9bxa2xe4xb8xadxefxbcx8cxe4xbbx96xe4xb8x8dxe8x83xbdxe5xbfx8dxe5x8fx97xe9xbbx91xe6x9ax97xefxbcx8cxe7x94xa8xe7xa5x9exe6x96xa7xe5x8ax88xe5x90x91xe5x9bx9bxe6x96xb9xefxbcx8cxe9x80x90xe6xb8x90xe4xbdxbfxe5xa4xa9xe7xa9xbaxe9xabx98xe8xbfx9cxefxbcx8cxe5xa4xa7xe5x9cxb0xe8xbexbdxe9x98x94xe3x80x82ntxe4xbbx96xe4xb8xbaxe4xb8x8dxe4xbdxbfxe5xa4xa9xe5x9cxb0xe4xbcx9axe9x87x8dxe6x96xb0xe5x90x88xe5xb9xb6xefxbcx8cxe7xbbxa7xe7xbbxadxe6x96xbdxe5xb1x95xe6xb3x95xe6x9cxafxe3x80x82xe6xafx8fxe5xbdx93xe7x9bx98xe5x8fxa4xe7x9ax84xe8xbaxabxe4xbdx93xe9x95xbfxe9xabx98xe4xb8x80xe5xb0xbaxefxbcx8cxe5xa4xa9xe7xa9xbaxe5xb0xb1xe9x9ax8fxe4xb9x8bxe5xa2x9exe9xabx98xe4xb8x80xe5xb0xbaxefxbcx8cntxe7xbbx8fxe8xbfx871.8xe4xb8x87xe5xa4x9axe5xb9xb4xe7x9ax84xe5x8axaaxe5x8ax9bxefxbcx8cxe7x9bx98xe5x8fxa4xe5x8fx98xe6x88x90xe4xb8x80xe4xbdx8dxe9xa1xb6xe5xa4xa9xe7xabx8bxe5x9cxb0xe7x9ax84xe5xb7xa8xe4xbaxbaxefxbcx8cxe8x80x8cxe5xa4xa9xe7xa9xbaxe4xb9x9fxe5x8dx87xe5xbex97xe9xabx98xe4xb8x8dxe5x8fxafxe5x8fx8axefxbcx8cxe5xa4xa7xe5x9cxb0xe4xb9x9fxe5x8fx98xe5xbex97xe5x8ex9axe5xaex9exe6x97xa0xe6xafx94xe3x80x82xe7x9bx98xe5x8fxa4xe7x94x9fxe5x89x8dxe5xaex8cxe6x88x90xe5xbcx80xe5xa4xa9xe8xbex9fxe5x9cxb0xe7x9ax84xe4xbcx9fxe5xa4xa7xe4xb8x9axe7xbbxa9xefxbcx8cxe6xadxbbxe5x90x8exe6xb0xb8xe8xbfx9cxe7x95x99xe7xbbx99xe5x90x8exe4xbaxbaxe6x97xa0xe7xa9xb7xe6x97xa0xe5xb0xbdxe7x9ax84xe5xaex9dxe8x97x8fxefxbcx8cxe6x88x90xe4xb8xbaxe4xb8xadxe5x8dx8exe6xb0x91xe6x97x8fxe5xb4x87xe6x8bx9cxe7x9ax84xe8x8bxb1xe9x9bx84xe3x80x82n']]
beeprint

[
[

'\nThe sky and the earth were at first one blurred entity like an egg. Pangu
 was born into it.\n \n\tThe separation of the sky and the earth took
 ...(12 hidden lines)',
'\n据民间神话传说古时盘古生在黑暗团中,他不能忍受黑暗,用神斧劈向四方,逐渐
 使天空高远,大地辽阔。\n\t他为不使天地会重新合并,继续施展法术。每当盘古的
 ...(3 hidden lines)',

],
]
怎么样,用 beeprint 来打印我们的 Python 对象是不是给我们开发调试带来了方便呢?

快来安装体验以下吧。

相关文章
|
1月前
|
监控 前端开发 JavaScript
Qt Quick调试之道:跟踪、输出与打印信息的全面攻略
Qt Quick调试之道:跟踪、输出与打印信息的全面攻略
59 0
|
6月前
|
前端开发 Java
前端基础 - 常用调试方式
前端基础 - 常用调试方式
36 0
|
23天前
|
程序员 编译器 C语言
编程最重要的技术之一 — 调试(以C语言代码为例)
编程最重要的技术之一 — 调试(以C语言代码为例)
39 0
|
8月前
|
IDE Shell Go
【100天精通python】Day18:python程序异常与调试_常用程序调试方式与技巧,如何将调试代码与正式代码分开
【100天精通python】Day18:python程序异常与调试_常用程序调试方式与技巧,如何将调试代码与正式代码分开
150 0
|
10月前
|
监控 程序员 编译器
代码的调试技巧
代码的调试技巧
|
10月前
|
程序员 C语言 C++
编程最重要的技术—调试(以C语言代码为例)
编程最重要的技术—调试(以C语言代码为例)
|
12月前
|
C++
VS中断点调试的功能
VS中断点调试的功能
66 0
|
Java 开发工具 C#
如何以超快的方式调试?
如何以超快的方式调试?
|
存储 小程序 容器
小程序中实现文章的关注功能
小程序中实现文章的关注功能
小程序中实现文章的关注功能
|
JSON 前端开发 JavaScript
接口测试平台代码实现41:调试窗口显示接口内容
接口测试平台代码实现41:调试窗口显示接口内容
接口测试平台代码实现41:调试窗口显示接口内容