YouTip LogoYouTip

Python3 Os Tcgetpgrp

# Python3.x Python3 os.tcgetpgrp() Method [![Image 3: Python3 OS File/Directory Methods](#) Python3 OS File/Directory Methods](#) * * * ### Overview The os.tcgetpgrp() method is used to return the process group associated with the terminal fd (an open file descriptor returned by os.open()). ### Syntax The syntax for the **tcgetpgrp()** method is as follows: os.tcgetpgrp(fd) ### Parameters * **fd** -- File descriptor. ### Return Value This method returns the process group. ### Example The following example demonstrates the use of the tcgetpgrp() method: #!/usr/bin/python3import os, sys # Display current directory print ("current directory :%s" %os.getcwd())# modify directory to /dev/tty fd = os.open("/dev/tty",os.O_RDONLY) f = os.tcgetpgrp(fd)# Display process group print ("Related process group: ")print (f) os.close(fd)print ("File closed successfully!!") The output of executing the above program is: current directory :/tmp Related process group:2670File closed successfully!! [![Image 4: Python3 OS File/Directory Methods](#) Python3 OS File/Directory Methods](#)
← Redis StreamBinary Search Remove β†’