python http://hi.baidu.com/isilencer/item/32d5ae5fabcda88709be17b7

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python http://hi.baidu.com/isilencer/item/32d5ae5fabcda88709be17b7相关的知识,希望对你有一定的参考价值。

#! /usr/bin/env python

#coding=utf-8

import pty
import os
import select

def mkpty():
#
	master1, slave = pty.openpty()
	slaveName1 = os.ttyname(slave)
	master2, slave = pty.openpty()
	slaveName2 = os.ttyname(slave)
	print '\nslave device names: ', slaveName1, slaveName2
	return master1, master2


if __name__ == "__main__":

	master1, master2 = mkpty()
	while True:
		rl, wl, el = select.select([master1,master2], [], [], 1)
		for master in rl:
			data = os.read(master, 128)
			print "read %d data." % len(data)
			if master==master1:
				os.write(master2, data)
			else:
				os.write(master1, data)

以上是关于python http://hi.baidu.com/isilencer/item/32d5ae5fabcda88709be17b7的主要内容,如果未能解决你的问题,请参考以下文章

代写python,代写python编程,python代写,python编程代写,留学生python代写

001--python全栈--基础知识--python安装

Python代写,Python作业代写,代写Python,代做Python

Python开发

Python,python,python

Python 介绍