tcsetpgrp() 方法设置通过 fd 给出与该终端相关联的进程组(由 os.open() 返回一个打开的文件描述符)到 pg.
	
语法
		当以下为 tcsetpgrp() 方法的语法:
	
os.tcsetpgrp(fd, pg)
参数
- 
			fd -- 这是在文件描述符 
- 
			pg -- 这将设置进程组为pg 
		
			返回值
		
	
	
		此方法不返回任何值。
	
	示例
		下面的示例显示 tcsetpgrp()方法的使用。
	
# !/usr/bin/python3
import os, sys
# Showing current directory 
print ("Current working dir :%s" %os.getcwd())
# Changing dir to /dev/tty
fd = os.open("/dev/tty",os.O_RDONLY)
f = os.tcgetpgrp(fd)
# Showing the process group
print ("the process group associated is: ")
print (f)
# Setting the process group
os.tcsetpgrp(fd,2672)
print ("done")
os.close(fd)
print "Closed the file successfully!!"
	
		当我们运行上面的程序,它会产生以下结果:
	
Current working dir is :/tmp the process group associated is: 2672 done Closed the file successfully!!
						上一篇:
								Python3文件方法
												下一篇:
								Python3 os文件目录的方法
												
						
						
					
					
					