Home >Backend Development >Python Tutorial >What is the way to run a python script
Under Windows:
Output through script
Use a text editor to write a script file and name it hello.py, enter the folder where this file is located in command line mode, enter python hello.py to execute Python in interactive mode. In this mode, there is no need to create a script file, just write the corresponding Python statement directly in the interactive mode of the Python interpreter.
Enter python directly in the terminal. If python3 is installed, enter the corresponding version of the Python interactive environment according to the name of the soft connection you created. For example, I use python3 to establish a soft connection, and enter python3 here.
Output in interactive mode: Hello World!
Through a text editor, Write a script file and name it hello.py. Enter python hello.py in the command line mode.
The command is as follows:
[Vicky@localhost code]$ touch hello.py [Vicky@localhost code]$ vi hello.py [Vicky@localhost code]$ python3 hello.py Hello World!
For more Python related technical articles, please visit
Python Tutorial
The above is the detailed content of What is the way to run a python script. For more information, please follow other related articles on the PHP Chinese website!