blob: b15d9812b0d0cb42ffba2495ad9543ca1475bc3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/usr/bin/env python
import sys, tty, termios
def getch():
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
#for i in range(256):
# Current Python unicode support was too hard to figure out.
# This only tests the true ASCII characters now:
for i in range(126):
c = getch()
a = ord(c) # chr(a)
print a
|