Home >Backend Development >Python Tutorial >How to debug breakpoints in pycharm
Perform breakpoint debugging in PyCharm, including: opening the debugging toolbar; setting breakpoints (click on the blank line number area on the left); starting debugging (debugger drop-down menu); executing code step by step (Step Over , Step Into, Step Out); view variables and expressions (hover or enter the debugger variables pane); continue debugging (continue button or F9); delete breakpoints (click the red dot or use "Delete all breakpoints" ” button).
How to do breakpoint debugging in PyCharm
Breakpoint debugging is a powerful tool that can help You step through the code and identify problems. To set breakpoints in PyCharm, you can follow these steps:
1. Open the debugging toolbar
Click "Run" in the menu bar> "Debug", or use the shortcut "Ctrl Alt Shift D" (Windows) or "Cmd Option Shift D" (Mac).
2. Set a breakpoint
On the line where you want the code to stop executing, click the blank line number area to the left. When a red dot appears around the line number, it indicates that a breakpoint has been set.
3. Start debugging
Click the "Debugger" drop-down menu in the debug toolbar and select "Debug" or "Debug 'filename.py'" . PyCharm will execute the code starting from the breakpoint line.
4. Step through code
When the code stops at a breakpoint, you can step through it using the buttons in the debug toolbar:
5. View variables and expressions
To view a variable or expression, hover over it in the code or in "Debugger Variables" Enter its name in the pane. You can also right-click a variable and select Evaluate Expression to evaluate an expression in the Console.
6. Continue debugging
You can use the "Continue" button or the shortcut key "F9" to continue executing the code until the next breakpoint or the end of the code.
7. Delete a breakpoint
To delete a breakpoint, click the red dot in the line number area again. You can also delete all breakpoints using the "Delete All Breakpoints" button in the debug toolbar.
The above is the detailed content of How to debug breakpoints in pycharm. For more information, please follow other related articles on the PHP Chinese website!