本文整理汇总了Python中posix.stat方法的典型用法代码示例。如果您正苦于以下问题:Python posix.stat方法的具体用法?Python posix.stat怎么用?Python posix.stat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类posix
的用法示例。
在下文中一共展示了posix.stat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _os_bootstrap
# 需要导入模块: import posix [as 别名]
# 或者: from posix import stat [as 别名]
def _os_bootstrap():
"Set up 'os' module replacement functions for use during import bootstrap."
names = sys.builtin_module_names
join = None
if 'posix' in names:
sep = '/'
from posix import stat
elif 'nt' in names:
sep = '\\'
from nt import stat
elif 'dos' in names:
sep = '\\'
from dos import stat
elif 'os2' in names:
sep = '\\'
from os2 import stat
else:
raise ImportError, 'no os specific module found'
if join is None:
def join(a, b, sep=sep):
if a == '':
return b
lastchar = a[-1:]
if lastchar == '/' or lastchar == sep:
return a + b
return a + sep + b
global _os_stat
_os_stat = stat
global _os_path_join
_os_path_join = join
示例2: test_stat
# 需要导入模块: import posix [as 别名]
# 或者: from posix import stat [as 别名]
def test_stat(self):
if hasattr(posix, 'stat'):
self.assert_(posix.stat(test_support.TESTFN))