First try using idle instead of Notepad. You can enter, save, and run the program from Idle. It should be under the python and then idlelib directories, and is something like Idle.py-I don't remember. That will solve the immediate problem. Your solution should work also, so it may be that it is in a part of the program that is not reached. Post the entire program if you want more info. To answer the question directly, use time.sleep(seconds)
import time
print "Starting Program"
time.sleep(2)
print "2 seconds are up already"
Edit: Here is a link to the python docs. See the "Starting IDLE on Windows" section and welcome to Python. http://www.python.org/idle/doc/idle2.html
woooee
Posting Maven
2,707 posts since Dec 2006
Reputation Points: 827
Solved Threads: 780
Skill Endorsements: 9
>>> print "hello World"
raw_input("Press ENTER to exit")
That is all I have for my code
Works for me on Linux. Try
print "Hello World"
raw_input("Press ENTER to exit")
raw_input("Press ENTER to exit")
raw_input("Press ENTER to exit")
It may be that when you enter the program name on the command line, it's using that Enter for the raw input. (Being a Linux person I would just say that MS Windows is weird.) Anyway, post back with the solution if you find it. Someone else will surely be searching for that in the future.
woooee
Posting Maven
2,707 posts since Dec 2006
Reputation Points: 827
Solved Threads: 780
Skill Endorsements: 9
Run it from Idle. There is a "run" option in the menu. Idle will display the output. So enter the code in Idle, save it in Idle, click on the "run" option in the menu, and look at the output all within Idle. Finally, you can try storing your input to a variable but I doubt that will help.
print "Hello World"
x = raw_input("Press Enter")
print "Bye Bye"
woooee
Posting Maven
2,707 posts since Dec 2006
Reputation Points: 827
Solved Threads: 780
Skill Endorsements: 9
You should have also seen "Press Enter" or whatever, then you hit the Enter key, and afterwards you should see "Bye, "Bye" on the screen. If that doesn't work, I would strongly suggest reinstalling Python as it appears there is a problem. Activestate has the easiest installer for a new user IMHO. http://aspn.activestate.com/ASPN/Downloads/ActivePython
woooee
Posting Maven
2,707 posts since Dec 2006
Reputation Points: 827
Solved Threads: 780
Skill Endorsements: 9
Question Answered as of 4 Years Ago by
woooee
and
ZZucker