text.py 文件源码

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

项目:LIE 作者: EmbraceLife 项目源码 文件源码
def __iter__(self):
        """ Return an iterator to the data. Yield the value for self.key
        from each object
        """
        start = 0
        while start < self.num_entries:
            end = min(self.num_entries, start + self.chunk_size)

            # linecache line numbering starts at 1
            batch = [
                json.loads(
                    linecache.getline(
                        self.source,
                        i + 1
                    ).strip()
                )[self.key]
                for i in self.indices[start:end]
            ]

            yield batch
            start = end

    ###########################################################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号