Python: stop output window from closing

After running your Python script, you might want to keep console window open not immediately close. That way you can see results of program you wrote. Here’s how to do that:
Option 1
In the end of script, add these lines:

from time import *

That will delay console windows closing by time defined inside parentheses. So sleep(10) will keep output window open for 10 seconds after script is executed.

a = 42
b = 2
print (a > b)

from time import *

Option 2
Add these lines in the of Python script:

a = input("Press ENTER to exit")

Console window will remain open until you press any key on your keyboard.

When you’re done with script, don’t forget to remove added lines!


Deprecated: Non-static method dc_jqslicksocial::footer() should not be called statically in /var/www/ on line 298

Notice: Undefined index: show_post in /var/www/ on line 805