Can't See The Output


When I open a python file, the console opens and closes. I cannot see the output.
What should I add in my code so that the console remains running and I see the output?
I have saved the file as


assumption: windows as OS

open the command prompt (start key + r, type: cmd), and run the file: python

or python3

this varies. Make sure you are in the right directory

You can also add sleep(5) to end of your script, you might need to import this (from time import sleep)


Isn't there any way where the console closes after pressing Enter key or such?


you could simply prompt for input and do nothing with it:

raw_input("press any key to exit")
input("press any key to exit")

but shouldn't you also want to learn to run scripts from command line?


Ok. That input("Press any key to continue") works.
Now when I try to run that python file from cmd it gives me the following error:

'python' is not recognized as an internal or external command,
operable program or batch file.

I created file on desktop and I am in the same directory. I tried both of these commands. The file name is same as I stated here.


did you add python to your path during installation? Such issues are really difficult to trouble shoot for me remotely on a forum


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.