skip to navigation
skip to content

readchar 0.2

Utilities to read single characters and key-strokes

Latest Version: 0.7


Library to easily read single chars and key strokes.

Goal and Philosophy

Born as a python-inquirer requirement.

The idea is to have a portable way to read single characters and key-strokes.



pip install readchar

The readchar library is compatible with python 2.6, 2.7, 3.2 and 3.3.


Usage example:

import readchar

c = readchar.readchar()
key = readchar.readkey()


There are just two methods:


Reads the next char from stdin, returning it as a string with length 1.


Reads the next key-stroke from stdin, returning it as an string.

A key-stroke can have:

  • 1 character for normal keys: ‘a’, ‘z’, ‘9’…
  • 2 characters for combinations with ALT: ALT+A, …
  • 3 characters for cursors: ->, <-, …
  • 4 characters for combinations with CTRL and ALT: CTRL+ALT+SUPR, …

There is a list of previously captured chars with their names in readchar.key, in order to be used in comparations and so on. This list is not enough tested and it can have mistakes, so use it carefully. Please, report them if found.

SO Support

Sadly, this library has only being probed in GNU/Linux. Please, if you can try it in another SO and find a bug, put an issue or send the pull-request.

Thank you!


Copyright (c) 2014 Miguel Ángel García (@magmax9).

Based on previous work on gist getch()-like unbuffered character reading from stdin on both Windows and Unix (Python recipe), started by Danny Yoo.

Licensed under the MIT license.

File Type Py Version Uploaded on Size
readchar-0.2.linux-i686.tar.gz (md5)
built for Linux-3.2.0-2-686-pae-i686-with-glibc2.4
"dumb" binary any 2014-05-07 6KB
readchar-0.2.tar.gz (md5) Source 2014-05-07 4KB
  • Downloads (All Versions):
  • 64 downloads in the last day
  • 473 downloads in the last week
  • 2402 downloads in the last month