Asking for Help: How do I stop the console/terminal/command line prompt from closing on Windows?

Ok so, Let's say I want to run a program with a simple Print("hello world"). How do I stop the console/terminal/command line prompt from closing immediately after it prints? I read somewhere that I'm supposed to find some editpythonprefs, but I don't know where it is... I am on Windows 7, if that helps


Are you running the program from the file manager or do you already have the console open when running the program (by typing python hello.py, for example)? If the former is involved, which I suspect is the case, you could prevent the program from finishing by inserting something like the following at the end:

raw_input("Press Enter to exit.")

I found a question about this by searching the Internet for "prevent Python program from exiting on Windows". You'll find other more complicated suggestions if you follow various links from that question, but sometimes the simplest solutions are the best (or are at least good enough).


CategoryAskingForHelp CategoryAskingForHelpAnswered

Asking for Help/Stop 'Hello World' from flashing (last edited 2011-05-05 19:25:47 by PaulBoddie)

Unable to edit the page? See the FrontPage for instructions.