How do we use Python in script mode?

PythonServer Side ProgrammingProgramming

It is possible to execute Python script from command line. Python program can be written by any text editor (preferably a Python aware text editor) and saved with .py extension. To write basic Hello World program using IDLE, the Python IDE shipped with standard Python distribution, open the editor choosing File->New.

Example

Type following lines and save as test.py

#!/usr/bin/python
 Print (“Hello World”)

Execute the script using following command line 

C:\users>python test.py

You can also run the script from Run Menu of IDLE file editor

raja
Published on 26-Dec-2017 19:31:42
Advertisements