Home  >  Article  >  Development Tools  >  How to write python program with vscode

How to write python program with vscode

王林
王林Original
2020-02-13 17:47:494267browse

How to write python program with vscode

Install the Python plug-in

How to write python program with vscode

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.

How to write python program with vscode

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.

How to write python program with vscode

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.

How to write python program with vscode

How to write python program with vscode

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:

How to write python program with vscode

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!

Statement:
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