Python3 os.openpty() 方法

Python 3 教程 · 2019-02-07 16:44:08

概述

os.openpty() 方法用于打开一个新的伪终端对。返回 pty 和 tty的文件描述符。

语法

openpty()方法语法格式如下:

os.openpty()

参数

返回值

返回文件描述符对,主从。

实例

以下实例演示了 openpty() 方法的使用:

#!/usr/bin/python3

import os

# 主 pty, 从 tty
m,s = os.openpty()

print (m)
print (s)

# 显示终端名
s = os.ttyname(s)
print (m)
print (s)

执行以上程序输出结果为:

3
4
3
/dev/pty0

点击查看所有 Python 3 教程 文章: https://codercto.com/courses/l/10.html

查看所有标签

Sass and Compass in Action

Sass and Compass in Action

Wynn Netherland、Nathan Weizenbaum、Chris Eppstein、Brandon Mathis / Manning Publications / 2013-8-2 / USD 44.99

Written by Sass and Compass creators * Complete Sass language reference * Covers prominent Compass community plug-ins * Innovative approach to creating stylesheets Cascading Style Sheets paint the we......一起来看看 《Sass and Compass in Action》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具