Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. def getch():
  2. import sys, tty, termios
  3. fd = sys.stdin.fileno()
  4. old_settings = termios.tcgetattr(fd)
  5. try:
  6. tty.setraw(sys.stdin.fileno())
  7. ch = sys.stdin.read(1)
  8. finally:
  9. termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
  10. return ch
  11.  
  12. x = getch()
  13. print(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement