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


Python genericpath._unicode方法代码示例

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


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

示例1: abspath

# 需要导入模块: import genericpath [as 别名]
# 或者: from genericpath import _unicode [as 别名]
def abspath(path):
    """Return an absolute path."""
    if not isabs(path):
        if isinstance(path, _unicode):
            cwd = os.getcwdu()
        else:
            cwd = os.getcwd()
        path = join(cwd, path)
    return normpath(path)

# realpath is a no-op on systems without islink support 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:macpath.py

示例2: abspath

# 需要导入模块: import genericpath [as 别名]
# 或者: from genericpath import _unicode [as 别名]
def abspath(path):
        """Return the absolute version of a path."""
        if not isabs(path):
            if isinstance(path, _unicode):
                cwd = os.getcwdu()
            else:
                cwd = os.getcwd()
            path = join(cwd, path)
        return normpath(path) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:ntpath.py

示例3: abspath

# 需要导入模块: import genericpath [as 别名]
# 或者: from genericpath import _unicode [as 别名]
def abspath(path):
    """Return an absolute path."""
    if not isabs(path):
        if isinstance(path, _unicode):
            cwd = os.getcwdu()
        else:
            cwd = os.getcwd()
        path = join(cwd, path)
    return normpath(path)


# Return a canonical path (i.e. the absolute location of a file on the
# filesystem). 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:15,代码来源:posixpath.py

示例4: abspath

# 需要导入模块: import genericpath [as 别名]
# 或者: from genericpath import _unicode [as 别名]
def abspath(path):
    """Return the absolute version of a path"""
    if not isabs(path):
        if isinstance(path, _unicode):
            cwd = os.getcwdu()
        else:
            cwd = os.getcwd()
        path = join(cwd, path)
    return normpath(path)

# realpath is a no-op on systems without islink support 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:os2emxpath.py

示例5: normpath

# 需要导入模块: import genericpath [as 别名]
# 或者: from genericpath import _unicode [as 别名]
def normpath(path):
    """Normalize path, eliminating double slashes, etc."""
    # Preserve unicode (if path is unicode)
    slash, dot = (u'/', u'.') if isinstance(path, _unicode) else ('/', '.')
    if path == '':
        return dot
    initial_slashes = path.startswith('/')
    # POSIX allows one or two initial slashes, but treats three or more
    # as single slash.
    if (initial_slashes and
        path.startswith('//') and not path.startswith('///')):
        initial_slashes = 2
    comps = path.split('/')
    new_comps = []
    for comp in comps:
        if comp in ('', '.'):
            continue
        if (comp != '..' or (not initial_slashes and not new_comps) or
             (new_comps and new_comps[-1] == '..')):
            new_comps.append(comp)
        elif new_comps:
            new_comps.pop()
    comps = new_comps
    path = slash.join(comps)
    if initial_slashes:
        path = slash*initial_slashes + path
    return path or dot 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:29,代码来源:posixpath.py


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