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://codercto.com/soft/d/20141.html

数论概论

数论概论

希尔弗曼 / 孙智伟 / 机械工业出版社 / 2008-5 / 42.00元

《数论概论(原书第3版)》讲述了有关数论大量有趣的知识,以及数论的一般方法和应用,循序渐进地启发读者用数学方法思考问题,此外还介绍了目前数论研究的某些前沿课题。《数论概论(原书第3版)》采用轻松的写作风格,引领读者进入美妙的数论世界,不断激发读者的好奇心,并通过一些精心设计的练习来培养读者的探索精神与创新能力。一起来看看 《数论概论》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

URL 编码/解码
URL 编码/解码

URL 编码/解码

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具