🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
### 导航 - [索引](../genindex.xhtml "总目录") - [模块](../py-modindex.xhtml "Python 模块索引") | - [下一页](pty.xhtml "pty --- Pseudo-terminal utilities") | - [上一页](termios.xhtml "termios --- POSIX style tty control") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) » - zh\_CN 3.7.3 [文档](../index.xhtml) » - [Python 标准库](index.xhtml) » - [Unix 专有服务](unix.xhtml) » - $('.inline-search').show(0); | # [`tty`](#module-tty "tty: Utility functions that perform common terminal control operations. (Unix)") --- 终端控制功能 **Source code:** [Lib/tty.py](https://github.com/python/cpython/tree/3.7/Lib/tty.py) \[https://github.com/python/cpython/tree/3.7/Lib/tty.py\] - - - - - - [`tty`](#module-tty "tty: Utility functions that perform common terminal control operations. (Unix)") 模块定义了将 tty 放入 cbreak 和 raw 模式的函数。 因为它需要 [`termios`](termios.xhtml#module-termios "termios: POSIX style tty control. (Unix)") 模块,所以只能在 Unix 上运行。 [`tty`](#module-tty "tty: Utility functions that perform common terminal control operations. (Unix)") 模块定义了以下函数: `tty.``setraw`(*fd*, *when=termios.TCSAFLUSH*)将文件描述符 *fd* 的模式更改为 raw 。如果 *when* 被省略,则默认为 `termios.TCSAFLUSH` ,并传递给 [`termios.tcsetattr()`](termios.xhtml#termios.tcsetattr "termios.tcsetattr") 。 `tty.``setcbreak`(*fd*, *when=termios.TCSAFLUSH*)将文件描述符 *fd* 的模式更改为 cbreak 。如果 *when* 被省略,则默认为 `termios.TCSAFLUSH` ,并传递给 [`termios.tcsetattr()`](termios.xhtml#termios.tcsetattr "termios.tcsetattr") 。 参见 模块 [`termios`](termios.xhtml#module-termios "termios: POSIX style tty control. (Unix)")低级终端控制接口。 ### 导航 - [索引](../genindex.xhtml "总目录") - [模块](../py-modindex.xhtml "Python 模块索引") | - [下一页](pty.xhtml "pty --- Pseudo-terminal utilities") | - [上一页](termios.xhtml "termios --- POSIX style tty control") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) » - zh\_CN 3.7.3 [文档](../index.xhtml) » - [Python 标准库](index.xhtml) » - [Unix 专有服务](unix.xhtml) » - $('.inline-search').show(0); | © [版权所有](../copyright.xhtml) 2001-2019, Python Software Foundation. Python 软件基金会是一个非盈利组织。 [请捐助。](https://www.python.org/psf/donations/) 最后更新于 5月 21, 2019. [发现了问题](../bugs.xhtml)? 使用[Sphinx](http://sphinx.pocoo.org/)1.8.4 创建。