Set breakpoints to run automatically in PyCharm
Set breakpoints to run automatically in PyCharm is a practical function that can help you quickly debug your code. Here's how to do it:
1. Set a breakpoint
- Position the cursor to the line of code where you want to set a breakpoint.
- Click the margin on the left edge of the editor (next to the line number), or use the shortcut key (Windows/Linux: F9, macOS: Command F9).
2. Open the "Breakpoint" tool window
- Click the "View" menu> "Tool Window" > "Breakpoint" . Or use the shortcut keys (Windows/Linux: Alt F8, macOS: Option F8).
3. Enable automatic running
- In the "Breakpoint" tool window, select the breakpoint you want to run automatically.
- Right-click on the breakpoint and select "Run to Cursor".
4. Run the code
- Press the debugging shortcut key (Windows/Linux: F5, macOS: Command F5).
- PyCharm will automatically run the code until a breakpoint is encountered.
- At a breakpoint, you can inspect variable values in the Variables window and perform individual steps or continue code execution.
5. Disable auto-run
- In the Breakpoints tool window, uncheck the breakpoint for which you want to disable auto-run. Alternatively, right-click the breakpoint and select Delete Run Configuration.
The above is the detailed content of How to set breakpoints in pycharm to run automatically. For more information, please follow other related articles on the PHP Chinese website!