How to stop the window from closing once a program has been executed in python? Do i have to add some keyword in the program or something??
there's a couple things you can do. the first is to launch Idle and then open your script with Idle and run it. or you can open a command prompt in your script's directory and type "python myscript.py" (you may need to set your Environment vaiables if on Windows to do it this way, btw). see here: http://www.youtube.com/watch?v=IokKz-LZsEo now, if you want to be able to double click it, you should add something like this to the last line of your program: raw_input('PRESS RETURN TO CLOSE') this will wait for user input before ending the program
You can right click the file, and choose "Edit with IDLE", then choose the Run from menu, and then Run Module( or just use F5 as a quick-button ), as you do this, you'll see the result in the python shell, and that'll never close.
You could also open a command prompt (assuming you're in Windows it would be CMD in the run box) and simply type python file.py (assuming you've setup your path to include Python).
Join our real-time social learning platform and learn together with your friends!