How to step through Python code to help debug issues?

前端 未结 14 1065
梦如初夏
梦如初夏 2020-11-22 11:17

In Java/C# you can easily step through code to trace what might be going wrong, and IDE\'s make this process very user friendly.

Can you trace through python code in

14条回答
  •  执念已碎
    2020-11-22 11:49

    Let's take look at what breakpoint() can do for you in 3.7+.

    I have installed ipdb and pdbpp, which are both enhanced debuggers, via

    pip install pdbpp
    pip install ipdb
    

    My test script, really doesn't do much, just calls breakpoint().

    #test_188_breakpoint.py
    myvars=dict(foo="bar")
    print("before breakpoint()")
    breakpoint()   # 

提交回复
热议问题