Home > Article > Backend Development > How to run a python program after writing it
There are two ways to run a program in Python: 1. Use the Python interpreter; 2. Call the script directly. Specific steps include: ① Create a Python script file; ② Open a terminal or command prompt; ③ Navigate to the script directory; ④ Use the corresponding method to run the script; ⑤ View the output.
How to run programs in Python
To run Python programs, there are two main methods:
1. Using the Python interpreter
<code>python script.py</code>
2. Call the script directly
If Python has been added to the system path:
<code>./script.py</code>
If Python is not added to the system path:
<code>python3 script.py</code>
Detailed steps:
The above is the detailed content of How to run a python program after writing it. For more information, please follow other related articles on the PHP Chinese website!