本文整理汇总了Python中sys.getPath函数的典型用法代码示例。如果您正苦于以下问题:Python getPath函数的具体用法?Python getPath怎么用?Python getPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getPath函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: exists
def exists(path):
"""Test whether a path exists.
Returns false for broken symbolic links.
"""
path = _tostr(path, "exists")
return File(sys.getPath(path)).exists()
开发者ID:Jarga,项目名称:IBM-Innovate-2012,代码行数:8,代码来源:javapath.py
示例2: getatime
def getatime(path):
# We can't detect access time so we return modification time. This
# matches the behaviour in os.stat().
path = _tostr(path, "getatime")
f = File(sys.getPath(path))
if not f.exists():
raise OSError(0, "No such file or directory", path)
return f.lastModified() / 1000.0
开发者ID:Jarga,项目名称:IBM-Innovate-2012,代码行数:8,代码来源:javapath.py
示例3: getsize
def getsize(path):
path = _tostr(path, "getsize")
f = File(sys.getPath(path))
size = f.length()
# Sadly, if the returned length is zero, we don't really know if the file
# is zero sized or does not exist.
if size == 0 and not f.exists():
raise OSError(0, "No such file or directory", path)
return size
开发者ID:Jarga,项目名称:IBM-Innovate-2012,代码行数:9,代码来源:javapath.py
示例4: mkdir
def mkdir(path, mode='ignored'):
"""mkdir(path [, mode=0777])
Create a directory.
The optional parameter is currently ignored.
"""
if not File(sys.getPath(path)).mkdir():
raise OSError(0, "couldn't make directory", path)
开发者ID:babble,项目名称:babble,代码行数:9,代码来源:os.py
示例5: abspath
def abspath(path):
"""Return the absolute version of a path."""
try:
if isinstance(path, unicode):
if path:
path = sys.getPath(path)
else:
# Empty path must return current working directory
path = os.getcwdu()
else:
if path:
path = sys.getPath(path).encode('latin-1')
else:
# Empty path must return current working directory
path = os.getcwd()
except EnvironmentError:
pass # Bad path - return unchanged.
return normpath(path)
开发者ID:AdrianPotter,项目名称:Pydev,代码行数:19,代码来源:ntpath.py
示例6: getmtime
def getmtime(path):
path = _tostr(path, "getmtime")
f = File(sys.getPath(path))
if not f.exists():
raise OSError(0, "No such file or directory", path)
return f.lastModified() / 1000.0
开发者ID:Jarga,项目名称:IBM-Innovate-2012,代码行数:6,代码来源:javapath.py
示例7: _realpath
def _realpath(path):
try:
return asPyString(File(sys.getPath(path)).getCanonicalPath())
except java.io.IOException:
return _abspath(path)
开发者ID:Jarga,项目名称:IBM-Innovate-2012,代码行数:5,代码来源:javapath.py
示例8: _abspath
def _abspath(path):
# Must use normpath separately because getAbsolutePath doesn't normalize
# and getCanonicalPath would eliminate symlinks.
return normpath(asPyString(File(sys.getPath(path)).getAbsolutePath()))
开发者ID:Jarga,项目名称:IBM-Innovate-2012,代码行数:4,代码来源:javapath.py
示例9: isdir
def isdir(path):
"""Test whether a path is a directory"""
path = _tostr(path, "isdir")
return File(sys.getPath(path)).isDirectory()
开发者ID:Jarga,项目名称:IBM-Innovate-2012,代码行数:4,代码来源:javapath.py
示例10: isfile
def isfile(path):
"""Test whether a path is a regular file"""
path = _tostr(path, "isfile")
return File(sys.getPath(path)).isFile()
开发者ID:Jarga,项目名称:IBM-Innovate-2012,代码行数:4,代码来源:javapath.py
示例11: rmdir
def rmdir(path):
"""rmdir(path)
Remove a directory."""
if not File(sys.getPath(path)).delete():
raise OSError(0, "couldn't delete directory", path)
开发者ID:babble,项目名称:babble,代码行数:6,代码来源:os.py
注:本文中的sys.getPath函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论