How to step through Python code to help debug issues?

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

    Python Tutor is an online single-step debugger meant for novices. You can put in code on the edit page then click "Visualize Execution" to start it running.

    Among other things, it supports:

    • live help from volunteers (which is great for newbies)
    • setting breakpoints
    • hiding variables
    • saving/sharing
    • a few other languages like Java, JS, Ruby, C, C++

    However it also doesn't support a lot of things, for example:

    • Reading/writing files - use io.StringIO and io.BytesIO instead: demo
    • Code that is too large, runs too long, or defines too many variables or objects
    • Command-line arguments
    • Lots of standard library modules like argparse, csv, enum, html, os, struct, weakref...

提交回复
热议问题