The running of a Python program is divided into two steps: 1. Use a text editor or IDE to write code in a Python file; 2. Use a Python interpreter, IDLE or a third-party IDE to run the code.
How to run a Python program
The running of a Python program is divided into two steps:
1. Write code
Use a text editor or IDE to create a Python file (.py
). Write your Python code in a file.
2. Run the code
There are several ways to run the Python program:
<code>python <文件名>.py</code>
For example: python my_program.py
Example:
<code class="python"># my_program.py print("Hello, world!")</code>
Running steps:
my_program.py
. python my_program.py
Output:
<code>Hello, world!</code>
The above is the detailed content of How to run a program in python. For more information, please follow other related articles on the PHP Chinese website!