1.python -m pdb xxxx.py
其中 -m 參數(shù) == module-name
Searches sys.path for the named module and runs the corresponding .py file as a script.
以pdb 就模塊 運(yùn)行xxxx.py
常用命令
常用pdb命令
2.交互調(diào)試 pdb.run("func()")
import pdb
測試test函數(shù) 既
pdb.run("test(100,100)");
其中需要函數(shù)調(diào)用字符串旺订,而不添加雙引號(hào)則為直接調(diào)用函數(shù)锭吨,
調(diào)用run函數(shù)后嫌松,進(jìn)入pdb模式 繼而s 進(jìn)入函數(shù)內(nèi)部進(jìn)行調(diào)試
3.埋點(diǎn)調(diào)試
import pdb
在需要添加斷點(diǎn)的地方添加 ? ?pdb.set_trace()