Your search query "linkto%3A%22Asking for Help%2FStop 'Hello World' from flashing%22" didn't return any results. Please change some terms and refer to HelpOnSearching for more information.
(!) Consider performing a full-text search with your search terms.

Clear message

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

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