How to step through Python code to help debug issues?

前端 未结 14 1171
梦如初夏
梦如初夏 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:52

    There is a module called 'pdb' in python. At the top of your python script you do

    import pdb
    pdb.set_trace()
    

    and you will enter into debugging mode. You can use 's' to step, 'n' to follow next line similar to what you would do with 'gdb' debugger.

提交回复
热议问题