Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getch():
- import sys, tty, termios
- fd = sys.stdin.fileno()
- old_settings = termios.tcgetattr(fd)
- try:
- tty.setraw(sys.stdin.fileno())
- ch = sys.stdin.read(1)
- finally:
- termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
- return ch
- x = getch()
- print(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement