python的pdb调试命令的命令整理及实例
(编辑:jimmy 日期: 2024/11/20 浏览:3 次 )
python的pdb调试命令的命令整理及实例
一、命令整理
二 pdb实例
E:\python\work>python -m pdb prime.py > e:\python\work\prime.py(1)<module>() ->import math (Pdb) list 1->import math 2def isprime(i): 3for t in range(2,int(math.sqrt(i))+1): 4if i % t ==0: 5return0 6else: 7return1 8 9print('100到110之间的素数为:') 10for i in range(100,110): 11if isprime(i): (Pdb) l 12,15 12print(i) 13 14 15 (Pdb) b 12 Breakpoint1 at e:\python\work\prime.py:12 (Pdb) b 7 Breakpoint2 at e:\python\work\prime.py:7 (Pdb) c 100到110之间的素数为: > e:\python\work\prime.py(7)isprime() ->return1 (Pdb) c > e:\python\work\prime.py(12)<module>() ->print(i) (Pdb) n 101 > e:\python\work\prime.py(10)<module>() ->for i in range(100,110): (Pdb) n > e:\python\work\prime.py(11)<module>() ->if isprime(i): (Pdb) n > e:\python\work\prime.py(10)<module>() ->for i in range(100,110): (Pdb) n > e:\python\work\prime.py(11)<module>() ->if isprime(i): (Pdb)print i ***SyntaxError:Missing parentheses in call to 'print' (Pdb) p i 103 (Pdb) where d:\python36\lib\bdb.py(431)run() ->exec(cmd, globals, locals) <string>(1)<module>() > e:\python\work\prime.py(11)<module>() ->if isprime(i): (Pdb)break NumTypeDispEnbWhere 1 breakpoint keep yes at e:\python\work\prime.py:12 breakpoint already hit 1 time 2 breakpoint keep yes at e:\python\work\prime.py:7 breakpoint already hit 1 time (Pdb) disable 1 Disabled breakpoint 1 at e:\python\work\prime.py:12 (Pdb)break NumTypeDispEnbWhere 1 breakpoint keep no at e:\python\work\prime.py:12 breakpoint already hit 1 time 2 breakpoint keep yes at e:\python\work\prime.py:7 breakpoint already hit 1 time (Pdb) n > e:\python\work\prime.py(7)isprime() ->return1 (Pdb) where d:\python36\lib\bdb.py(431)run() ->exec(cmd, globals, locals) <string>(1)<module>() e:\python\work\prime.py(11)<module>() ->if isprime(i): > e:\python\work\prime.py(7)isprime() ->return1 (Pdb) cl Clear all breaks? y Deleted breakpoint 1 at e:\python\work\prime.py:12 Deleted breakpoint 2 at e:\python\work\prime.py:7 (Pdb)break (Pdb) c 103 105 107 109 The program finished and will be restarted > e:\python\work\prime.py(1)<module>()
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
下一篇:Windows平台Python连接sqlite3数据库的方法分析