擅长:python、mysql、java
<p>对于基本功能,请使用<a href="http://docs.python.org/library/tty.html" rel="nofollow noreferrer">^{<cd1>}</a>。例如,调用<code>tty.setraw(sys.stdin)</code>将使标准输入的终端进入原始模式。</p>
<p>对于更一般的情况,Python附带了一个<a href="http://docs.python.org/library/termios.html" rel="nofollow noreferrer">termios library</a>,但是您可能需要一些termios的经验才能知道如何使用它。</p>
<p>或者,一种廉价的方法是将shell输出到<code>stty</code>,这是termios的命令行接口。</p>