Missing command

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • olivervaga
    New Member
    • Jul 2008
    • 1

    Missing command

    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 :)
  • Laharl
    Recognized Expert Contributor
    • Sep 2007
    • 849

    #2
    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.

    Comment

    • jlm699
      Contributor
      • Jul 2007
      • 314

      #3
      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:
      [code=python]
      raw_input( 'Press enter to quit' )
      # This message is completely arbitrary, btw...
      [/code]

      This way the console will stay open and wait for the user to press enter before quitting.

      Comment

      Working...