本文整理汇总了Python中ciscoconfparse.CiscoConfParse.splitlines方法的典型用法代码示例。如果您正苦于以下问题:Python CiscoConfParse.splitlines方法的具体用法?Python CiscoConfParse.splitlines怎么用?Python CiscoConfParse.splitlines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ciscoconfparse.CiscoConfParse
的用法示例。
在下文中一共展示了CiscoConfParse.splitlines方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_running_config
# 需要导入模块: from ciscoconfparse import CiscoConfParse [as 别名]
# 或者: from ciscoconfparse.CiscoConfParse import splitlines [as 别名]
def get_running_config(chan, enable_password):
"""
captures the running config
:param chan: ssh channel
:param enable_password: enable password
:return: running config
"""
# sends 'show running-config' to device
running_config = send_command('skip', 'sh run', read=True, chan=chan)
time.sleep(2)
# Capture only running config data
running_config = re.findall(r'!\r\nver.*end', running_config, re.S).pop()
# Parses config
running_config = CiscoConfParse(running_config.splitlines())
print("Download complete")
return running_config