


Useful Python plug-ins and configurations under VSCode_python
This article mainly introduces Microsoft’s official Python plug-in, which already has many functions. The following is a description of the plug-in function. I have translated some of the content. Friends who need it can refer to it
MS Python plugin.
This is Microsoft’s official Python plug-in, which already comes with many functions. The following is a description of the plug-in function, part of which I have translated.
a) Linting (Prospector, Pylint, pycodestyle, Flake8, pylama, pydocstyle, mypy with config files and plugins) static code scanning (can be understood as code syntax and format error prompts, supports multiple linters)
b) out out out out off , , out ,, , Over to be in the 10-year-old's 3-year-old's 3-year-old's
d) Code formatting (autopep8, yapf, with config files) Code automatic formatting
e) Code refactoring (Rename, Extract Variable, Extract Method, Sort Imports)Code refactoring (Rename, Extract Variable, Extract Method, Sort Imports) Named, extracted variables, extraction methods, sorting it)
F) Viewing References, Code Navigation, View Signature View quotation, code navigation, check the signature
## ste) Excellent Debugging (Remote Deb ugging Over SSH, Mutliple Threads, Django, Flask) Perfect debug support (via SSH remote debugging, multi -thread, Django, Flask)## h) Running and debugging unit tests (Unittest, Pytest, NOTESE, WIT h config files ) Run and debug unit tests
i) Execute file or code in a python terminal Yes, basic needs are met. For example, if you want to automatically format the code, you only need to press Alt+Shift+F, and vscode will call autopep8 to automatically format the code (off topic, Visual Studio is Ctrl+K, D).
But we are not satisfied with this, we want to realize our own style. For example, Snippets, if we enter for, select the corresponding snippet in the prompt box:
Click Enter or tab, it becomes:for target_list in expression_list: pass
If we want to define our own Snippets, for example, if we want to quickly enter for xx in enumerator() to traverse, what should we do? First open File-Preferences-User Code Snippets. vscode will prompt you to select the language. We enter Python and press Enter to open python.json. The content format is json. Add a new object of your own below the root level. The content is as follows:
"For in enumerator": { "prefix": "for/enum", "body": [ "for ${1:index}, ${2:item} in enumerate(${3:array}):", " ${4:pass}" ], "description": "For statement with enumerator" }
In this way, after we enter for/enum and press Enter , it is automatically generated:
for index, item in enumerate(array): pass
The cursor stays on index and selects the word. We can directly modify it, press tab to switch to item, and then array , pass.
Guides: Indentation TipsSome people say that there are already indentation reference lines in vscode, what else do you need Guides for? Indeed, vscode has indentation lines, but this Guide is better than the built-in indentation line. Please see the picture below:
The current level indentation line will change. Red, it is clear which level you are currently at.
vscode-icons file icon set, supports more file types, and most importantly, looks better!Others
There are also some python plug-in configurations, which I won’t go into detail one by one. You can search them in the settings (File-Preferences-Settings). Includes:
a) autopep8/yapf: automatically formats code;
b) pylint-django: compatible with pylint of Django, requires pip install; c) flakes8 :Error message.
Hope you all have a good time~
Related recommendations:
How to configure the python debugging runtime environment under VSCode_python
The above is the detailed content of Useful Python plug-ins and configurations under VSCode_python. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

To run Python code in Sublime Text, you need to install the Python plug-in first, then create a .py file and write the code, and finally press Ctrl B to run the code, and the output will be displayed in the console.

Golang is better than Python in terms of performance and scalability. 1) Golang's compilation-type characteristics and efficient concurrency model make it perform well in high concurrency scenarios. 2) Python, as an interpreted language, executes slowly, but can optimize performance through tools such as Cython.

Running Python code in Notepad requires the Python executable and NppExec plug-in to be installed. After installing Python and adding PATH to it, configure the command "python" and the parameter "{CURRENT_DIRECTORY}{FILE_NAME}" in the NppExec plug-in to run Python code in Notepad through the shortcut key "F6".

Golang and Python each have their own advantages: Golang is suitable for high performance and concurrent programming, while Python is suitable for data science and web development. Golang is known for its concurrency model and efficient performance, while Python is known for its concise syntax and rich library ecosystem.

Python is easier to learn and use, while C is more powerful but complex. 1. Python syntax is concise and suitable for beginners. Dynamic typing and automatic memory management make it easy to use, but may cause runtime errors. 2.C provides low-level control and advanced features, suitable for high-performance applications, but has a high learning threshold and requires manual memory and type safety management.
