📜  python 如何reversetty.setraw(sys.stdin) - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:13.836000             🧑  作者: Mango

代码示例1
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
    tty.setraw(fd)
    data = "stuff" # whatever it is you need doing
    return data
finally:
    termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)