Created
April 22, 2015 13:15
-
-
Save cvubrugier/2868ab3bc66e9ba5cc14 to your computer and use it in GitHub Desktop.
Revisions
-
Christophe Vu-Brugier created this gist
Apr 22, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ #!/usr/bin/python from __future__ import print_function import sys import termios import tty def main(): fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd) try: tty.setraw(sys.stdin.fileno()) r = sys.stdin.read(5) finally: termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) print('r = %r' % r) if __name__ == '__main__': main()