Python has become one of the popular programming languages in 2022.
This article will guide you to use Visual Studio Code – A versatile Editor developed by MicroSoft.
1. To install
You download from the link below (Official Link of Microsoft) DOWNLOAD VISUAL STUDIO CODE
The installation is very easy, you select the installation file corresponding to the operating system used, double-click to install the software.
2. Extensions that support programming
Visual Studio Code is developed by Microsoft for many programming languages, so to program Python on it, you need to install some necessary extensions.
To install the extension by command, on VS code press [ Ctrl + P ], enter the installation command and type [ Enter ]
To install normally, press [ Ctrl + Shift + X ] or click the Extension icon on VS code, search for the necessary extension and click [ Install ] to install.
3. VS . User Manual
Create Workspace
From the VS Code window, press the key combination [ Ctrl + N ]
Create file hello-world.py
Next time you want to reopen the Project just select [ Ctrl + O ] browse to this file.
4. Run python script
After creating the file hello-world.py , to run this file we right-click on the file and select “Run python file in terminal”
Result:
5. Some good tips when programming Python with VS
a. Jump to a function
Hold [ Ctrl ] and click function, method to jump to the function you defined.
b. Format source code according to PEP 8 . standard
python -m pip install -U autopep8 --user
Press the key combination [ Ctrl + Shift + I ] to format the source code file for them.