__init__.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:otRebuilder 作者: Pal3love 项目源码 文件源码
def getReadFileForPath(self, path, encoding=None):
        """
        Returns a file (or file-like) object for the
        file at the given path. The path must be relative
        to the UFO path. Returns None if the file does not exist.
        An encoding may be passed if needed.

        Note: The caller is responsible for closing the open file.
        """
        fullPath = os.path.join(self._path, path)
        if not self._checkForFile(fullPath):
            return None
        if os.path.isdir(fullPath):
            raise UFOLibError("%s is a directory." % path)
        if encoding:
            f = open(fullPath, "rb", encoding=encoding)
        else:
            f = open(fullPath, "r")
        return f
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号