我是一个初学者python学习和被困在这个问题。。。如果您能提供任何关于编写python脚本的专家建议和帮助,我将不胜感激,该脚本可以通过查看下面一组/一组行中的特定分隔符来读取和搜索配置文件。你知道吗
开始分隔符:^vpls\s\d+
结束分隔符:^!$
##This is an example subset of an Alcatel router config:
!
vpls xxx
sdp 1.1.1.1
backup
lsp LSP-1
... #some other settings here (not needed)
exit
sdp 2.2.2.2
lsp LSP-2
... #some other settings here (not needed)
exit
!
vpls yyy
sdp 1.1.1.1
backup
lsp LSP-1
... #some other settings here (not needed)
exit
sdp 2.2.2.2
lsp LSP-2
... #some other settings here (not needed)
exit
!
我想要实现的是,请注意,在导出到csv后,备份在标准格式序列的最后一项上传输:
vpls xxx : sdp 1.1.1.1 : lsp LSP-1 : backup
vpls xxx : sdp 2.2.2.2 : lsp LSP-2 :
vpls yyy : sdp 1.1.1.1 : lsp LSP-1 : backup
vpls yyy : sdp 2.2.2.2 : lsp LSP-2 :
我做了这个剧本。在
router_cfg
中,我存储了您提供的输出。你知道吗如果你有什么不明白的,尽管问。你知道吗
相关问题 更多 >
编程相关推荐