This seems to work a bit better:
and 31 for the len of working_config
I can see information in the working_config list, but it looks like all the indexes contain the same information
# declare an empty list config = [] # open the file with open(r"c:\\Temp\python\switch\switch.txt", mode='r') as f: # switchports = f.read().split('!') for switchports in f.read().split('!'): config.append(switchports) # create a copy of the list working_config = [item for item in config if "GigabitEthernet" in item]Now I get 196 for the len of config
and 31 for the len of working_config
I can see information in the working_config list, but it looks like all the indexes contain the same information