By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,705 Members | 1,216 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,705 IT Pros & Developers. It's quick & easy.

Missing command

P: 1
I've been doing some programming in class. Our teacher teaches using Turbo Pascal 7.0.

Now, I've fiddled around with Python and am reading some tutorials.

My question is, what's the command for readkey(as in Pascal)? The command that keeps the lines on screen until I press any key. Otherwise when I run the script, it executes all the commands and terminates without me being able to see the output.

Some help would be much appreciated :)
Jul 23 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 849
Python doesn't really have anything like that, but have you tried running some scripts in your IDE or on the command line? I think you'll find it isn't really necessary, as from the sounds of it, readkey() is used to ensure that you can see output when running code in IDEs that flash console windows.
Jul 23 '08 #2

P: 314
There is a work around that I use in a situation such as yours... at the end of all my code I simply put the following:
Expand|Select|Wrap|Line Numbers
  1. raw_input( 'Press enter to quit' )
  2. # This message is completely arbitrary, btw...
This way the console will stay open and wait for the user to press enter before quitting.
Jul 23 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.