__init__.py 文件源码

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

项目:otRebuilder 作者: Pal3love 项目源码 文件源码
def readBytesFromPath(self, path, encoding=None):
        """
        Returns the bytes in 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.
        """
        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, encoding=encoding)
        else:
            f = open(fullPath, "rb", encoding=encoding)
        data = f.read()
        f.close()
        return data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号