always worry about is the debugging of Python, once wrote C is compiled with GDB directly debugging, relaxed and happy. Now, this is an interpretive procedure. I don't know what to do. Use log bar, sometimes it is a small program, do not want to write so much code. Let's play a screen. Sometimes the screen turns fast, is also very depressed. The end of the day was good, and saw a practical thing.
PDB
method One: Execute python-m pdb myscript.py
(PDB) will voluntarily stop on the first line. Wait for debugging, then you can see Help
(Pdb) H
explain these key commands
< breakpoint settings
(Pdb) b #断点设置在本py的第10行
or (Pdb) b ots.py:20 #断点设置到 ots.py line 20th
Delete Breakpoint (Pdb) b #查看断点编号
(PDB) CL 2 #删除第2个断点
< execution
(Pdb) n #单步执行
(PDB) s #细点执行 that's going down, method
(Pdb) c #跳到下个断点
< View
(Pdb) p param #查看当前 Variable value
(Pdb) L #查看执行到某处代码
(Pdb) a #查看所有栈内变量
< The assumption is that the debugs in the command line are:
Import PDB
def TT ():
pdb.set_trace ()
For I in range (1, 5):
Print I
<<< tt ()
#这里支持 n P C.
< (3) TT ()
(PDB) n
Python Debug Single-Step debugging