PyScribe是一个Pytho库,可通过prit语句进行调试程序更加方便简单和高效。
示例程序:
from pyscribe import pyscribedef mai(): ps = pyscribe.Scriber() ps.save_logs(True) x = 5 ps.p(x) bar = "foo" for i i xrage(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, uit="^") syoyms = {"clerk": "secretary", "studet": "appretice", "groud": "floor"} ps.p(syoyms)if __ame__ == "__mai__": mai()日志:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Log saved at 2014-12-31 22:03:48%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%From lie 9: x is the it 5----------------------------------------bar is the str foo at begiig of for loop at lie 12From lie 14: I iteratio 0, bar chaged to foo0From lie 14: I iteratio 1, bar chaged to foo01From lie 14: I iteratio 2, bar chaged to foo012From lie 14: I iteratio 3, bar chaged to foo0123From lie 14: I iteratio 4, bar chaged to foo01234From lie 17: y is the str helloFrom lie 18: Watchig variable y, curretly str helloFrom lie 20: y chaged to worldFrom lie 23: ----------------------------------------foo is the it 1234----------------------------------------From lie 24: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^foo is the it 1234^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^From lie 27: syoyms is the dict {'clerk': 'secretary', 'studet': 'appretice', 'groud': 'floor'}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Ed of log%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
评论