Apr-07-2019, 09:52 PM
(This post was last modified: Apr-07-2019, 10:08 PM by mrapple2020.)
Update:
if I do
match = '0/7/CPU0' #match is the 'interface' variable.
Then I get a match now. Ding. Maybe I need to extract the /CPU0 info from the list of CPU value....
Output:
Interface:0/7/CPU0 CPU list:['0/7/CPU0', '1/0/CPU0', '1/2/CPU0']
[0]
Interface:0/7/CPU0 CPU list:['0/7/CPU0', '1/0/CPU0', '1/2/CPU0']
[0]
exit...
if I do
match = '0/7/CPU0' #match is the 'interface' variable.
Then I get a match now. Ding. Maybe I need to extract the /CPU0 info from the list of CPU value....
Output:
Interface:0/7/CPU0 CPU list:['0/7/CPU0', '1/0/CPU0', '1/2/CPU0']
[0]
Interface:0/7/CPU0 CPU list:['0/7/CPU0', '1/0/CPU0', '1/2/CPU0']
[0]
exit...
(Apr-07-2019, 09:52 PM)mrapple2020 Wrote: Hello, I tried both suggestions and it is not triggering a match. Any other options?
#match is the 'interface' variable. I tried both '0/7' and ['0/7']. It does not find a match. match='[0/7]' if match: for k, v in arch_dic.items(): print (f'Interface:{match} CPU list:{v}') if match in v: #print('Interface {match} is in {v}; PSE2...') print([index for index, value in enumerate(v) if match in value])#Result of the print above is this. As we can see, there is an interface '0/7' which should cause a match against the CPU list. It is not working. Any ideas?
Interface:['0/5'] CPU list:['0/7/CPU0', '1/0/CPU0', '1/2/CPU0']
Interface:['0/7'] CPU list:['0/7/CPU0', '1/0/CPU0', '1/2/CPU0']
exit...