Of console I/O, characters, strings & dogs
sjmachin at lexicon.net
Tue Dec 30 05:52:25 CET 2008
On Dec 30, 11:53 am, David Lemper wrote:
> I am trying getch() from msvcrt.
Unfortunately the msvcrt docs have not been 2to3ified:
Read a keypress and return the resulting character. Nothing is echoed
to the console. This call will block if a keypress is not already
available, but will not wait for Enter to be pressed. If the pressed
key was a special function key, this will return '\000' or '\xe0'; the
next call will return the keycode. The Control-C keypress cannot be
read with this function.
Wide char variant of getch(), returning a Unicode value.
In Python 3.0, getch() returns a length-1 bytes object. getwch()
returns a length-1 str object.
(1) Do more of the 3.0 tutorial so that you understand the bytes/str
(2) Use getwch instead of getch
(3) Consider whether the builtins print() and input() cover your needs
for console IO.
More information about the Python-list