import sys, select, tty, termios

old_attr = termios.tcgetattr(sys.stdin)
tty.setcbreak(sys.stdin.fileno())
print('Please input keys, press Ctrl + C to quit') while():
if select.select([sys.stdin], [], [], )[] == [sys.stdin]:
print(sys.stdin.read()) termios.tcsetattr(sys.stdin, termios.TCSADRAIN, old_attr)
参考:
https://blog.csdn.net/NiYintang/article/details/86116591
05-28 23:48