How To Debug a Pyhon Program

I have used python for several months and find it important to know how to debug a python program, to toggle breakpoints, to view the stacks and so on.

How to run a program in IDLE

In python IDLE, we can click menu Run -- Run Module to execute our program, alse we can use F5.

Perhaps the most common way to debug program is to PRINT! We can print types, values even where the program is.

But just printing out is not a good method, it's inconvenience and inefficient.

So we need to toggle break points and control the program as we need.

How to debug a program with IDLE

In python IDLE, we can click menu Run -- Python Shell, and in Python Shell, we can choose Debug -- Debugger. Thus there will be a window for Debug Control. Then you will need to go back to the window of Edit Window and Press F5. In this way, you start your debugger. Also you can toggle breakpoints in the Edit Window.

原文地址:https://www.cnblogs.com/johnpher/p/2573008.html