Install the Python plug-in
Ensure that the Python installation directory must be added to the system environment variable for the plug-in to run properly. Computer->Properties->Advanced System Settings->Environment Variables, find "Path" in the system variables, double-click to open it, add the Python installation path after "Variable Value", confirm and save.
Create a folder to store the source code of the project. I created a directory VScode/one under the e drive.
Click "Open folder" on the welcome page and select the directory just created e:/VScode/one.
Click "New File" as shown in the picture below, enter the file name "one.py" in the input box, double-click the file "one.py" to see the code writing area.
Write code, for example:
#coding:utf-8 ''' VS写的第一个Python程序 ''' if __name__=="__main__": name = input("What\'s your name?\n") print("Hello %s"%name) input("按任意键结束")
Press F5 to run the code, the running effect is as shown below:
Recommended related articles and tutorials: vscode tutorial
The above is the detailed content of How to write python program with vscode. For more information, please follow other related articles on the PHP Chinese website!