小白教程
所有教程
关于
Search
172.71.254.7
172.71.254.7
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Python3 os tcgetpgrp”的源代码
本页内容
上一节:
Python3_os_symlink
下一节:
Python3_os_tcsetpgrp
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:os.tcgetpgrp(fd)}}[[Category:python3 os file methods|54]] = Python3 os.tcgetpgrp() 方法 = [[python3 os file methods|Python3 OS 文件/目录方法]] === 概述 === os.tcgetpgrp() 方法用于回与终端fd(一个由os.open()返回的打开的文件描述符)关联的进程组。 === 语法 === '''tcgetpgrp()'''方法语法格式如下: <sample title="" desc="" lang="python" hererun="1"> os.tcgetpgrp(fd) </sample> === 参数 === * '''fd''' -- 文件描述符。 === 返回值 === 该方法返回进程组。 == 以下实例演示了 tcgetpgrp() 方法的使用: <sample title="" desc="" lang="python" hererun="1"> #!/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 ("关闭文件成功!!") </sample> 执行以上程序输出结果为: <sample title="" desc="" lang="python" hererun="1"> 当前目录 :/tmp 相关进程组: 2670 关闭文件成功!! </sample> [[python3 os file methods|Python3 OS 文件/目录方法]]
返回至“
Python3 os tcgetpgrp
”。
上一节:
Python3_os_symlink
下一节:
Python3_os_tcsetpgrp