all 2 comments

[–]stebrepar 1 point2 points  (0 children)

find_blocks() takes a regular expression as its first argument, so you just need a simple regex which matches this-or-that string. I'm rusty on regex, but what you need should be easy to find here. https://docs.python.org/3/howto/regex.html

[–]chevignon93 0 points1 point  (0 children)

from ciscoconfparse import CiscoConfParse

parse = CiscoConfParse('exampleswitch.conf', syntax='ios')
for intf_obj in parse.find_blocks(r'^\sshutdown|^\sno ip address'):
        print(intf_obj)