1

In C/C++ if you want to enter a character without anything being printed on the screen, you can use getch(). Is there any way I can do this in python?

Ananda
  • 2,925
  • 5
  • 22
  • 45
  • Possible duplicate of [Python read a single character from the user](http://stackoverflow.com/questions/510357/python-read-a-single-character-from-the-user) – Artyer Mar 09 '17 at 20:41

1 Answers1

1

With getpass.getpass(), which is intended for getting passwords:

>>> import getpass
>>> a = getpass.getpass()
Password:
>>> a
'asdf'
TigerhawkT3
  • 48,464
  • 6
  • 60
  • 97
  • this is great but I was actually looking for something that will take a single character from the keyboard and does not wait for the enter press to proceed. with getch() you do not have to wait for the enter press to continue to the next line(I realise that this means I can only enter one key at a time which is fine). Does anything like this exists? Thanks! – Ananda Dec 02 '16 at 16:19