小白教程
所有教程
关于
Search
172.70.100.47
172.70.100.47
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Python3 os readlink”的源代码
本页内容
上一节:
Python3_os_read
下一节:
Python3_os_remove
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:os.readlink(path)}}[[Category:python3 os file methods|44]] = Python3 os.readlink() 方法 = [[python3 os file methods|Python3 OS 文件/目录方法]] === 概述 === os.readlink() 方法用于返回软链接所指向的文件,可能返回绝对或相对路径。 在Unix中有效 === 语法 === '''readlink()'''方法语法格式如下: <sample title="" desc="" lang="python" hererun="1"> os.readlink(path) </sample> === 参数 === * '''path''' -- 要查找的软链接路径 === 返回值 === 返回软链接所指向的文件 == 以下实例演示了 readlink() 方法的使用: <sample title="" desc="" lang="python" hererun="1"> #!/usr/bin/python3 import os src = '/usr/bin/python' dst = '/tmp/python' # 创建软链接 os.symlink(src, dst) # 使用软链接显示源链接 path = os.readlink( dst ) print (path) </sample> 执行以上程序输出结果为: <sample title="" desc="" lang="python" hererun="1"> /usr/bin/python </sample> [[python3 os file methods|Python3 OS 文件/目录方法]]
返回至“
Python3 os readlink
”。
上一节:
Python3_os_read
下一节:
Python3_os_remove