Defination of Script Mode -: Script file mode is also called File Mode. This is use for making a python programme. After creating python program this file store in hard disk. We can save this file and run this file using the command line or IDLE.
Difference Between Interactive Mode and Script Mode
Interactive Mode -: When we are doing dubugging for a program or testing a program or we are doing any other experiment we can use this mode. In this mode all the command are not saved. Here Print command are not necessary. Here program are not saved so in this mode no extension requirement.
Script Mode -: We can use this file mode for making a project because all the program are saved in the hard disk storage. All the command also saved in the program. Print command are necessary without print command we can not print the value. For saving the program .py extension are necessary. Here we can make a .pyc file or we can make a installer .exe file and deliver software to client.
Here we are makinng a python program to running a command line. First Install Python Program in your system. Click here for Install
Making a simple program in python language first open a text editor. Here i have a Notepad text editior. i am opening this editior and write a program here.
Now save this file using .py extension. we give this file name netnic.py and saved in a particualr folder.
Now Open the folder which you saved a python program and click the address bar and type cmd and press the enter. Now give this command as like here and Press enter here
C:\Python Program>python script.py
Now the Output of this program will show here as like
I Love Python
How to Save Python Program Output in the system -: when we are using cmd command and run this program it will store in RAM memory. When we close this window it will deleted. For saving the output of this we use another command here as like. This program output will show in the output1.txt file.
python script.py >output1.txt
Using exec to run module file-: To run exec we use another command line. First go to the cmd command here as like
C:\Python Program> C:\Python Program>python //press enter exec(open('netnic.py').read()) //here netnic.py is a file name