本文整理汇总了Python中unipath.Path.stat方法的典型用法代码示例。如果您正苦于以下问题:Python Path.stat方法的具体用法?Python Path.stat怎么用?Python Path.stat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unipath.Path
的用法示例。
在下文中一共展示了Path.stat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_closest_uid
# 需要导入模块: from unipath import Path [as 别名]
# 或者: from unipath.Path import stat [as 别名]
def get_closest_uid(path):
path = Path(path)
while not path.isdir():
path = path.ancestor(1)
if path == '/':
return False
return path.stat().st_uid
示例2: print
# 需要导入模块: from unipath import Path [as 别名]
# 或者: from unipath.Path import stat [as 别名]
# 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))
# Stat and lstat
print("\n*** Stat and lstat")
print(here.stat()) # File stat object for size, permissions etc. Symbolic links are followed.
print(here.lstat()) # Same as stat but symbolic links are not followed.