Pause in Python

One way is to leave a raw_input() at the end so the script waits for you to press Enter before it terminates.


Try os.system("pause") — I used it and it worked for me.

Make sure to include import os at the top of your script.


There's no need to wait for input before closing, just change your command like so:

cmd /K python <script>

The /K switch will execute the command that follows, but leave the command interpreter window open, in contrast to /C, which executes and then closes.