Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 2
    On windows I ran into the same problem as in this question. The solution is to replace the msvcrt.getch with msvcrt.getwch, as suggested there. Commented Sep 8, 2018 at 18:53
  • Solution is install getch module "pip install getch". For Python2 use command "pip2 install files.pythonhosted.org/packages/56/f7/…". This solution also works in Termux (Android). Commented Dec 17, 2019 at 8:34
  • The simplest solution is to use sshkeyboard. It requires less coding than getch, and it is a cross platform solution. Commented Oct 28, 2021 at 7:49
  • 2
    I can't believe all these complicated answers. In Ruby: input = STDIN.getch That's literally it. Commented Jan 16, 2022 at 11:46
  • @user93883 NameError: global name 'STDIN' is not defined . Maybe it's not all that straightforward after all. Commented Mar 14, 2022 at 17:37