Python 调试库 PyScribe

码农软件 · 软件分类 · 程序调试工具 · 2019-11-30 18:13:00

软件介绍

PyScribe 是一个 Python 库,可通过 print 语句进行调试程序更加方便简单和高效。

示例程序:

from pyscribe import pyscribe

def main():
    ps = pyscribe.Scriber()

    ps.save_logs(True)

    x = 5
    ps.p(x)

    bar = "foo"
    for i in xrange(5):
        bar += str(i)
        ps.iterscribe(bar)

    y = "hello"
    ps.p(y)
    ps.watch(y)

    y = "world"

    foo = 1234
    ps.d(foo)
    ps.d(foo, unit="^")

    synonyms = {"clerk": "secretary", "student": "apprentice", "ground": "floor"}
    ps.p(synonyms)

if __name__ == "__main__":
    main()

日志:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Log saved at 2014-12-31 22:03:48
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

From line 9: x is the int 5
----------------------------------------
bar is the str foo at beginning of for loop at line 12
From line 14: In iteration 0, bar changed to foo0
From line 14: In iteration 1, bar changed to foo01
From line 14: In iteration 2, bar changed to foo012
From line 14: In iteration 3, bar changed to foo0123
From line 14: In iteration 4, bar changed to foo01234
From line 17: y is the str hello
From line 18: Watching variable y, currently str hello
From line 20: y changed to world
From line 23: 
----------------------------------------
foo is the int 1234
----------------------------------------

From line 24: 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
foo is the int 1234
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

From line 27: synonyms is the dict {'clerk': 'secretary', 'student': 'apprentice', 'ground': 'floor'}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
End of log
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

本文地址:https://www.codercto.com/soft/d/20141.html

做自己:鬼脚七自媒体第一季

做自己:鬼脚七自媒体第一季

鬼脚七 / 电子工业出版社 / 2013-7 / 77.00元

当我们习惯了在社会上带着面具的时候,真实成为了一件奢侈的事情。 做到足够真实,让自己的本性表达出来,这需要勇敢。本书是鬼脚七自媒体的原创文集,主题就是做自己。本书有关于生活、互联网、自媒体的睿智分享,也有关于淘宝、搜索的独到见解,是一本接地气,文艺范,并充满正能量的电商生活书。 本书最适合淘宝卖家、电子商务人群、希望了解电商和互联网的人群阅读,也推荐热爱生活的70、80、90后阅读。一起来看看 《做自己:鬼脚七自媒体第一季》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具