I have just started college and we are going to be using python. We really have done nothing so I have downloaded the program and done some print commands, and that\'s it.
If you just want a delay
from time import *
sleep(20)
The reason why it is closing is because the program is not running anymore, simply add any sort of loop or input to fix this (or you could just run it through idle.)
Late in here, but in case someone comes here from google---
Go to the location of your .py file. Press SHIFT then right click anywhere and choose open command prompt from here. Once it's up, Just add
"python NameOfTheProg.py" to the cmd line
In Python 2.7 adding this to the end of my py file (if __name__ == '__main__':
) works:
closeInput = raw_input("Press ENTER to exit")
print "Closing..."
Very simple:
python.exe
(provided you have given path of it in environmental variables)Then, In the same command prompt window the python interpreter will start with >>>
This worked for me.
Well I got similar issue, It is solved by adding Environment Variable.
Add System Variables in Window
Name : PYTHONPATH
Value : C:\Python27;
Your Python path.