scrape.py 文件源码

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

项目:xr-telemetry-m2m-web 作者: cisco 项目源码 文件源码
def commit_history(cli):
    """
    Parse output of "show configuration history commit reverse detail"
    """
    result = []
    record = OrderedDict()
    for line in cli.splitlines():
        r = re.search(' ([A-Z][a-z]+(?: ID)?): (.*?) +([A-Z][a-z]+): (.*)', line)
        if not r:
            continue
        record[r.group(1)] = r.group(2)
        record[r.group(3)] = r.group(4)
        if r.group(3) == 'Comment':
            result.append(record)
            record = OrderedDict()
    return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号