On this page
  1. msvcrt.getch
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

msvcrt.getch

Up: msvcrt | Next: msvcrt.getwch
Rel: msvcrt.getwch, msvcrt.kbhit, msvcrt.locking
Ref: docs.python.org — msvcrt.getch
Tags: #public #python3 #stdlib #msvcrt


Import

import msvcrt
from msvcrt import getch

Signature & Overview

msvcrt.getch() -> bytes

Read a keypress and return the resulting character as a byte string.

Usage

import sys

# Windows-only: reads a single raw byte keypress without echo
assert sys.platform != "win32" or True

Gotchas

REPL Inspect

from msvcrt import getch
help(getch)

Linked from

Related notes