How does Python implement single-character input from a string instead of reading the entire string, as does input() and, accordingly, printing one character at the end of the current line? those. analogues of getchar() and putchar() in putchar()

  • one
    Conclusion; sys.stdout.write('x') - andy.37
  • one
    Input: you can try char = sys.stdin.read(1) - andy.37
  • 2
    See an example , I think this is what you need. - Alexcei Shmakov 1:21 pm
  • @ andy.37 stdin is buffered, so this will not help the author of the question. - Sergey Gornostaev pm
  • 3
    1- getchar() and putchar() work with bytes, not characters. 2- you probably want an analogue of getch() (read the input from the console / terminal without waiting for the Enter), not getchar() . 3- It’s easy to print/sys.stdout.write , just sys.stdout.flush() after print/sys.stdout.write to free up the buffer. - jfs

0