Site icon TestingDocs.com

Running a Python Script

Introduction

There are many different ways to run a Python script on your machine. In this tutorial, we will run a sample Python script in different ways on Windows operating system.

Using Interactive Interpreter

You can launch a Python interpreter by using the command prompt.

Launch command prompt. Run >> cmd

Alternatively, you can launch Python from the Start menu as shown below.

 

 

Type python in the command prompt

/> python

 

Command Prompt

You can execute a Python script from the command line by specifying the script filename.

Add your code with your favorite editor like Notepad, Notepad++, Textpad etc.
Save your code in a file with .py extension.
Run the script

Let say you have named the file as “program.py”, you can run the same by typing

/> python program.py

Eclipse IDE

You can run Python from an IDE( Integrated Development Environment) such as Eclipse.

Steps to run a script in Eclipse.

 

Python Tutorial on this website can be found at:

https://www.testingdocs.com/python-tutorials/

More information on Python is available at the official website:

https://www.python.org

Exit mobile version