getchar [was: Re: Python-list Digest, Vol 38, Issue 72]

Steve Holden steve at holdenweb.com
Mon Nov 6 14:43:47 EST 2006


Santosh Chikkerur wrote:
> Hi Friends,
> 
> How to use getchar( ) in python. I want to see the output of the program 
> ,step by step.
> I have given print statements in between for the results..
> Hence i would like to print the output everytime there is 
> getchar().which is the
> similar fn in python
> 
[... several hundred lines of irrelevant digest omitted ...]
In future please don't quote the whole of a digest just to ask a simple 
question! Instead send an email to python-list at python.org. Also, it 
helps if you can give a subject line that indicates what you are asking 
about.

Python has getch() in Windows only, there is no getchar(). If you want 
your program to be portable to Linux/Unix as well then getch() won't do. 
I have seen a portable recipe, but my google-fu is low today so I'll 
have to let someone else point that out if you need it.

However, if the Enter key will do then just try inserting

raw_input("Hit Enter to continue: ")

That'll work on any platform.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list