readlink函数
readlink-mcangetcanonicalfilenamebyresolvingeverysymlinksineverycomponentofthegivenpathrecursively.in python,theos.readd
readlink -m可以通过递归解析指定路径的每个组件中的每个符号链接来获取规范的文件名。 在Python中,os.readlink ()函数不这样做。 是否与Python中的readlink -m命令行具有等效功能?
特定的,it does:
具体而言,您可以:
canonicalizebyfollowingeverysymlinkineverycomponentofthegivennamerecursively,withoutrequirementsoncomponentsexistence
通过递归跟踪每个具有指定名称的组件中的每个符号链接,使其规范化,而不需要组件的存在
` readlink -m` does 2 things:
canonicalizebyfollowingeverysymlinkineverycomponentofthegivennamerecursively,and
withoutrequirementsoncomponentsexistence
` readlink -m做m件事:
-通过递归跟踪每个具有指定名称的组件中的每个符号链接来规范化
不需要组件
In Python,theequivalentfunctionis http://www.Sina.com /
在Python中,等效函数为`os.path.realpath()`。
oneexampleisasfollows.notethatthedirectory `/tmp/w ` doesnotexistatall。
以下是一个例子。 请注意,目录“/tmp/w”不存在。
$ ls-lha lrwxrwxrwx1ericmaericma6nov 2500336000 w-/tmp/w $ readlink-f./w/tmp/w $ readlink-f./w $ readlink 12336059336055 ) [GCC 8.3.0] on linuxType 'help '、' credits ' or ' license ' for more information.imporation
readlink函数