Python3 os.tcgetpgrp () method
Python3 OS file / directory methods
Outline
Process os.tcgetpgrp () method is used to return the terminal fd (consisting os.open returned () open file descriptors) associated with the group.
grammar
tcgetpgrp () method syntax is as follows:
os.tcgetpgrp(fd)
parameter
fd - file descriptor.
return value
This method returns process group.
Examples
The following example demonstrates tcgetpgrp () method of use:
#!/usr/bin/python3 import os, sys # 显示当前目录 print ("当前目录 :%s" %os.getcwd()) # 修改目录到 /dev/tty fd = os.open("/dev/tty",os.O_RDONLY) f = os.tcgetpgrp(fd) # 显示进程组 print ("相关进程组: ") print (f) os.close(fd) print ("关闭文件成功!!")
The above program output is:
当前目录 :/tmp 相关进程组: 2670 关闭文件成功!!