当前位置: 首页>>代码示例>>Python>>正文


Python Path.islink方法代码示例

本文整理汇总了Python中unipath.Path.islink方法的典型用法代码示例。如果您正苦于以下问题:Python Path.islink方法的具体用法?Python Path.islink怎么用?Python Path.islink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unipath.Path的用法示例。


在下文中一共展示了Path.islink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: dump_path

# 需要导入模块: from unipath import Path [as 别名]
# 或者: from unipath.Path import islink [as 别名]
def dump_path(path, prefix="", tab="    ", file=None):
    if file is None:
        file = sys.stdout
    p = Path(path)
    if   p.islink():
        print >>file, "%s%s -> %s" % (prefix, p.name, p.read_link())
    elif p.isdir():
        print >>file, "%s%s:" % (prefix, p.name)
        for p2 in p.listdir():
            dump_path(p2, prefix+tab, tab, file)
    else:
        print >>file, "%s%s  (%d)" % (prefix, p.name, p.size())
开发者ID:Alwnikrotikz,项目名称:promogest,代码行数:14,代码来源:tools.py

示例2: path

# 需要导入模块: from unipath import Path [as 别名]
# 或者: from unipath.Path import islink [as 别名]

# Expands system variable and ~. Will also normalise the path ( remove redundant
# .. . incorrect slashes and correct capitalisation on case sensitive file systems. Calls os.path.normpath

# File Attributes and permissions
print("\n*** File Attributes and permissions")
# noinspection PyArgumentList
print(here.atime())  # Last access time; seconds past epcoh
# noinspection PyArgumentList
print(here.ctime())  # Last permission or ownership modification; windows is creation time;
# noinspection PyArgumentList
print(here.isfile())  # Is a file; symbolic links are followed.
print(here.isdir())  # Is a directory; symbolic links are followed.
# noinspection PyArgumentList
print(here.islink())  # Is a symbolic link
# noinspection PyArgumentList
print(here.ismount())  # Is a mount point; ie the parent is on a different device.
# noinspection PyArgumentList
print(here.exists())  # File exists; symbolic links are followed.
# noinspection PyArgumentList
print(here.lexists())  # Same as exists but symbolic links are not followed.
# noinspection PyArgumentList
print(here.size())  # File size in bytes.
print(Path("/foo").isabsolute())  # Is absolute and not relative path

# Epoch?
print("\n*** gmtime")
print(gmtime(0))

开发者ID:lukewickstead,项目名称:PythonPit,代码行数:30,代码来源:unipath_example.py


注:本文中的unipath.Path.islink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。