CBSE Class 11: Working in Script Mode

Python Editor Window (Working in Script Mode)

Till now we were working with the interactive mode where there is no provision for storing or saving the commands that we have typed at the Python command prompt.

All the command along with their output , get cleared as soon as we close the shell window. This limitation can be overcome by working in the Python Script Mode where we can save the commands we have entered. This switchover is carried out through Python shell itself.
Working with Python script mode involves the following steps:

 

Step:1
Creating Script/Program file
File->New File Option allows us to open a new window i.e. Python editor window, which is a simple text editor where we can type or edit commands.
At the time of opening, this file is named “Untitled” by default as shown below:

Step:2
Saving the file
Our next step is to save the file by clicking
File->Save As option followed by giving a proper name of the file.

Python files are saved with extension name as “.py” Example “welcome.py”

Step:3
Runing Script/Program file\
To execute the file we use
Run->Run Module or F5 to get the output

Exiting Python IDLE

In order to exit the Python command prompt we can use
>>> exit()
or
>>>quit()