【发布时间】:2019-08-28 08:50:06
【问题描述】:
对于 Python 中的文件系统比较工具,我想找出符号链接的链接文本是什么。我不想跟踪链接,而是找到链接文本以及它是绝对的还是相对的。
示例:对于通过 ls -l 打印的链接
lrwxr-xr-x 1 tutor staff 16B 25 Aug 17:13 etc -> dir-with-dir/etc
我想准确地以这种相对形式检索文本“dir-with-dir/etc”。
如何在 Python 中访问这些信息?
【问题讨论】:
标签: python python-3.x filesystems symlink