溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

好程序員Python學(xué)習(xí)路線(xiàn)分享Beeprint怎么用

發(fā)布時(shí)間:2020-06-18 14:11:11 來(lái)源:網(wǎng)絡(luò) 閱讀:224 作者:wx5d42865f47214 欄目:云計(jì)算

好程序員Python學(xué)習(xí)路線(xiàn)分享Beeprint怎么用,beeprint:讓你的調(diào)試打印更友好

推薦一個(gè)國(guó)人的開(kāi)源項(xiàng)目 beeprint,可以更加漂亮的打印你的調(diào)試信息。對(duì)標(biāo) Python 標(biāo)準(zhǔn)庫(kù)的 pprint。

下面我們就來(lái)看一下 beeprint 和 pprint 打印 Python 對(duì)象的對(duì)比。

打印字典對(duì)象

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': [],
},
}
打印類(lèi)對(duì)象

pprint

<class 'definition.NormalClassNewStyle'>
beeprint

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

pprint

<definition.NormalClassNewStyle object at 0x7f338e5a9dd0>
beeprint

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

pprint

[['\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 eighteen thousand years-the yang which was light and pure rose to become the sky, \tand the yin which was heavy and murky\xef\xbc\x88\xe6\x9c\xa6\xe8\x83\xa7\xe7\x9a\x84\xef\xbc\x89 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',
'\n\xe6\x8d\xae\xe6\xb0\x91\xe9\x97\xb4\xe7\xa5\x9e\xe8\xaf\x9d\xe4\xbc\xa0\xe8\xaf\xb4\xe5\x8f\xa4\xe6\x97\xb6\xe7\x9b\x98\xe5\x8f\xa4\xe7\x94\x9f\xe5\x9c\xa8\xe9\xbb\x91\xe6\x9a\x97\xe5\x9b\xa2\xe4\xb8\xad\xef\xbc\x8c\xe4\xbb\x96\xe4\xb8\x8d\xe8\x83\xbd\xe5\xbf\x8d\xe5\x8f\x97\xe9\xbb\x91\xe6\x9a\x97\xef\xbc\x8c\xe7\x94\xa8\xe7\xa5\x9e\xe6\x96\xa7\xe5\x8a\x88\xe5\x90\x91\xe5\x9b\x9b\xe6\x96\xb9\xef\xbc\x8c\xe9\x80\x90\xe6\xb8\x90\xe4\xbd\xbf\xe5\xa4\xa9\xe7\xa9\xba\xe9\xab\x98\xe8\xbf\x9c\xef\xbc\x8c\xe5\xa4\xa7\xe5\x9c\xb0\xe8\xbe\xbd\xe9\x98\x94\xe3\x80\x82\n\t\xe4\xbb\x96\xe4\xb8\xba\xe4\xb8\x8d\xe4\xbd\xbf\xe5\xa4\xa9\xe5\x9c\xb0\xe4\xbc\x9a\xe9\x87\x8d\xe6\x96\xb0\xe5\x90\x88\xe5\xb9\xb6\xef\xbc\x8c\xe7\xbb\xa7\xe7\xbb\xad\xe6\x96\xbd\xe5\xb1\x95\xe6\xb3\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x99\xe5\x90\x8e\xe4\xba\xba\xe6\x97\xa0\xe7\xa9\xb7\xe6\x97\xa0\xe5\xb0\xbd\xe7\x9a\x84\xe5\xae\x9d\xe8\x97\x8f\xef\xbc\x8c\xe6\x88\x90\xe4\xb8\xba\xe4\xb8\xad\xe5\x8d\x8e\xe6\xb0\x91\xe6\x97\x8f\xe5\xb4\x87\xe6\x8b\x9c\xe7\x9a\x84\xe8\x8b\xb1\xe9\x9b\x84\xe3\x80\x82\n']]
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據(jù)民間神話(huà)傳說(shuō)古時(shí)盤(pán)古生在黑暗團(tuán)中,他不能忍受黑暗,用神斧劈向四方,逐漸
使天空高遠(yuǎn),大地遼闊。\n\t他為不使天地會(huì)重新合并,繼續(xù)施展法術(shù)。每當(dāng)盤(pán)古的
...(3 hidden lines)',
],
]
怎么樣,用 beeprint 來(lái)打印我們的 Python 對(duì)象是不是給我們開(kāi)發(fā)調(diào)試帶來(lái)了方便呢?

快來(lái)安裝體驗(yàn)以下吧。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI