0

GNU read has -n options and that can set the character that will read, from document:

-n nchars

read returns after reading nchars characters rather

than waiting for a complete line of input.

read -n 1 will only read one character and quit.

But input() will read the input until user type Enter (like read without -n option does).


And I didn't find any option of input() . Does input() support this or Python has other function can do this?

Remi Guan
  • 21,506
  • 17
  • 64
  • 87
  • 3
    `input()` can't do this - you might want to take a look at [the `curses` module](https://docs.python.org/3.5/howto/curses.html) in the standard library, which supports more advanced input at the console. – Gareth Latty Sep 27 '15 at 07:22
  • @Latty Let me see that :) – Remi Guan Sep 27 '15 at 07:23

0 Answers0