Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Does vscode support python?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article is about whether vscode supports python or not. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Does vscode support python?

Vscode supports python, as long as you install the python plug-in and press F5 directly to run python code. Click on the lower left corner of the interface to switch between different python environments.

Specific actions:

Build an environment

Search for the extension Python in VSCode, and that's what it is:

After installation, reload. In the picture above, I have already installed it, so what is shown is the disable and uninstall button.

Next, you can have fun with Python. Isn't it convenient?

Basic operation

Start your first piece of Python code in VSCode. The Pylint feature of the Python plug-in will give you automatic prompts, auto-completion, and error prompts as you type.

I need to remind PythonER that in VSCode, including VS, Tab defaults to 4 spaces.

Several commonly used shortcut keys, it is estimated that VSer can be painless conversion:

First of all, it is F1 Ctrlple Shit + P universal key. Who uses it and who knows?

Ctrl+P: file switching

Ctrl+ spaces: auto prompt

F12Universe Ctrl + left: jump to definition

Shift+F12: preview definition

Ctrl+G: jump line number

Ctrl+/: comment toggle

Alt+ ↑↓: move the whole line up and down

Ctrl+ ↑↓: the editor scrollbar moves up and down vertically without moving the cursor

Ctrl+Backspace/Delete: whole words / successive blank deletions

Ctrl+ →←: cursor whole word movement

Ctrl+F search / Ctrl+Shift+F search in the file, which are universal, not to mention similar ah.

Ctrl + plus / minus signs enlarge and reduce fonts

Preview the definition diagram:

Debugging operation

F5 debug and run anytime, anywhere. Note that VSCode stops at the first sentence by default after debugging, as shown in the following figure.

Debug shortcuts are basically the same as VS.

F5: debug / continue

F10: skip step by step

F11: step in

Shift+F11: jump out.

F9: toggle breakpoint

From top to bottom, the Debug window on the left shows the mode used for debugging, variables (local variables, monitoring), call stack, breakpoints, and so on. Basically, all the features we need are here.

A bad design is variables, monitoring these places where the width is too small, and viewing some long variables is not as convenient as VS. But fortunately, we have a debugging console, so just type in the variable name.

It should be reminded here that among the drop-down debug modes in the upper left corner, the two commonly used are Python and Integrated Terminal/Console. The first is to debug and run in the environment that comes with the plug-in, and the second is in the integrated console. The problem is that input () input is not supported in the first one, 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 the relative path and cannot accurately find the path of the current file, which is a bad thing about this software.

If you want to see the value of a variable, you must set a breakpoint and then step through it. Once set up, press F5 to run, and the program is paused when it reaches the breakpoint. When you move the mouse over the variable name in the code, you can see the value of the variable.

How to set the breakpoint: click to the left of the line number of any line of code, and the red dot indicates that the breakpoint is set successfully.

When a bug interrupt occurs in the program, 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 established when running the code, it can not find a member, it will report an error: Module 'xx' has no' xx' member, but this does not affect the running of the code.

Thank you for reading! This is the end of this article on whether vscode supports python or not. I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report