Does vscode support python?
vscode supports python. You only need to install the python plug-in and press the F5 key to run the python code. Click on the lower left corner of the interface to switch between different python environments.
Specific operations:
Build the environment
Search for extended Python in VSCode, that is This product:
After installation, reload. In the picture above, because I have already installed it, the disable and uninstall buttons are displayed.
Now you can have fun playing with Python. Isn’t it super convenient?
Basic operation
Start your first Python code in VSCode. The Pylint function that comes with the Python plug-in will automatically Prompts, autocomplete, and error messages.
I need to remind all PythonERs that in VSCode, including VS, Tabs are 4 spaces by default.
Several commonly used operation shortcut keys, it is estimated that VSers can switch them painlessly:
The first is the F1/Ctrl Shit P universal key, who uses it? Who knows
Ctrl P: File switch
Ctrl Space: Automatic prompt
F12/ Ctrl left click: Jump to definition
Shift F12: Preview definition
Ctrl G: Jump to line number
Ctrl /: Comment switching
Debugging operation
F5 debugging runs anytime and anywhere. Note that VSCode will stop at the first sentence after debugging by default, as shown below. The debugging shortcut keys are basically the same as those in VS.The Debug window on the left displays from top to bottom: Modes used for debugging, variables (local variables, watches), call stacks, breakpoints, etc. Basically all the functions we need are here.
#One bad design is that the width of variables and monitoring areas is too small. Viewing some long variables is not as convenient as VS. But fortunately we have a debugging console, just type in the variable name.
What needs to be reminded here is that in the drop-down selection debugging mode in the upper left corner, the two commonly used ones are Python and Integrated Terminal/Console. The first one is to debug and run in the environment that comes with the plug-in. The second one is to debug and run in the environment that comes with the plug-in. The first is the integrated console. The problem is that the first type does not support input() input yet, so if you want to debug a program with input, you can choose Integrated Terminal/Console or External Terminal/Console.
Note: vscode does not recognize relative paths and cannot accurately find the path of the current file. This is a disadvantage of this software. a little.
If you want to see the value of a variable, you must set a breakpoint and then single-step debugging. After setting up, press F5 to run. The program will pause when it reaches the breakpoint. At this time, when you move the mouse over the variable name in the code, you can see the value of the variable.
How to set a breakpoint: Click on the left side of the line number of any line of code. A red dot appears to indicate that the breakpoint is set successfully.
When the program is interrupted by a bug, you can also see the value of the variable.
pylint is vscode's Python syntax checker. Pylint is a static check. When using a third-party library, some members will only be created when the code is run. If it cannot find the members, it will report an error. : Module 'xx' has no 'xx' member, but this does not affect the operation of the code.
Recommended tutorial:
vscode tutorialThe above is the detailed content of Does vscode support python?. For more information, please follow other related articles on the PHP Chinese website!