Debug Python Code in Visual Studio Code
If you like this post, please click the ads on the blog or buy me a coffee. Thank you very much.
Step 1: Configure the debugger
Go to line 2 of
test.py and press F9 to set a breakpoint.
Then, click the Debug View in the sidebar:
Use the Debug > Open configurations menu command to open the debug configuration:
Select Python: Current File (Integrated Terminal),
Add the
"stopOnEntry": true
setting to the current configuration file:
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"stopOnEntry": true
}
Step 2: Run the debugger
Save
launch.json, switch to test.py in the editor, then run the debugger by selecting the Debug icon from the menu in the left toolbar.If you see the following screen in your environment, you could debug your program now. Congratulation!!!!
若您覺得文章寫得不錯,請點選文章上的廣告,來支持小編,謝謝。
If you like this post, please click the ads on the blog or buy me a coffee. Thank you very much.


留言