Run Python Script
Using the Python Interactive prompt, you can run only one command or Python statement one at a time. Python Script allows you to run multiple statements to accomplish a particular task.
The Python script can be written using an editor like Notepad or Notepad++:
- Save the Python script.
- The Python script files have .py file extension.
> python script.py
This command invokes the Python interpreter in script mode. It begins executing the script and continues until the script is finished.
Example
To run a Python test in the script file GoogleHomePageTest.py
You can use the following command. Note that you need to change the directory to the script directory path. Assume the script file is in the directory PythonProject under the C:
You can use the change directory command at the prompt to switch the working directory:
> cd C:PythonProject
> python GoogleHomePageTest.py
Â