Cisco.py 文件源码

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

项目:nettools 作者: germandutchwindtunnels 项目源码 文件源码
def filter_output(self, output, regex):
        """ Filter output from a command """
        result = {}
        result_list = []
        if isinstance(output, str):
            lines = [output]
        else:
            lines = output

        for line in lines:
            iterator = re.finditer(regex, line)
            try:
                while True:
                    cur = iterator.next()
                    result = cur.groupdict()
                    result['hostname'] = self.host
                    result_list.append(result)
            except StopIteration:
                pass

        return result_list
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号