Python                                                          Home : www.sharetechnote.com

 

 

 

 

How to Run ?

 

There are a couple of different ways to run Python command. One is to run the command within Python interpreter and the other one is to run it as script file.

 

< Run in Python Interpreter >

 

If you run python.exe, you will get Python Interpreter running as shown below. Then you can type in Python command and Press Enter to get the result. Try type in print("Hello World") and press Enter

 

 

If you installed the recent Python version (e.g, Python 3.x), you may see Python.exe icon in Windows button as shown below (I am using Windows 7) and just click the Python menu to get Python Interpreter running.

 

 

 

< Run as Python Script >

 

In most case, you may write a sequence of Python command in a file and run the file as explained in this section.

 

First, create a Python script as shown below. You can use any text editor like notepad or Python scriptor Editor "IDLE" or any other text editor. Save the file as filename.py (In this example, I saved file as HelloWorld.py)

 

 

Once you created the python script file, you can just double click the file to run it. (This double click may or may not work depending on which version of Python you are using or configurations in your Operating System).

 

In most case, you may run as follows. Run windows command and go to the folder where your script is located and type in 'python.exe filename.py' in python.exe path is set in your operating system path setting. If 'python.exe filename.py' does not work, you have to specify full path for python.exe as shown below.