Home > Development Tools > VSCode > body text

Does vscode support python?

青灯夜游
Release: 2020-04-23 15:31:08
Original
7952 people have browsed it

Does vscode support python?

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:

Does vscode support python?

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.

Does vscode support python?

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

  • ##Alt ↑↓: Move the entire line up and down

  • Ctrl ↑↓: Editor vertical The scroll bar moves up and down, the cursor does not move

  • Ctrl Backspace/Delete: delete the whole word/continuous blanks

  • Ctrl →←: the cursor whole word Move

  • Ctrl F to search/Ctrl Shift F to search in files, these are all universal, I won’t talk about similar ones.

  • Ctrl plus/minus sign to enlarge and reduce the font

Preview definition image:

Does vscode support python?

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.

  • F5: Debug/continue,

  • F10: Single step skip,

  • ##F11 : Single step to enter,
  • Shift F11: Jump out.
  • F9: Switch breakpoints

Does vscode support python?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.

Does vscode support python?#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 tutorial

The above is the detailed content of Does vscode support python?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template