Apr-07-2019, 11:31 PM
(This post was last modified: Apr-07-2019, 11:44 PM by mrapple2020.)
Wait a minute.
If I do:
#Interface variable match:
match='0/7'
Then I execute it and I get a match. So it seems the issue is that [] character still on the interface "match" variable. But when I converted it to string, I thought it would go away. Do you agree I need to replace the [] with no characters here?
Original data from appliance, dictionary:defaultdict(<class 'list'>, {'PSE2': ['0/7/CPU0', '1/0/CPU0', '1/2/CPU0']})
Printing original interface value=['0/5']
type of values v <class 'str'> ['0/7/CPU0', '1/0/CPU0', '1/2/CPU0'] and type of interface:<class 'str'> ['0/5']
Now printing manually assigned value to match interface: 0/7
**** FINALLY FOUND IT ****
Original data from appliance, dictionary:defaultdict(<class 'list'>, {'PSE2': ['0/7/CPU0', '1/0/CPU0', '1/2/CPU0']})
Printing original interface value=['0/7']
type of values v <class 'str'> ['0/7/CPU0', '1/0/CPU0', '1/2/CPU0'] and type of interface:<class 'str'> ['0/7']
Now printing manually assigned value to match interface: 0/7
**** FINALLY FOUND IT ****
exit...
I see we replied at the same time.
Sure I understand the problem now.
I no longer convert the dictionary values 'v' into a string.
Then it is obvious the interface value 'match' is still showing:
Printing original interface value=['0/7']
So can you tell me again your thoughts if it is needed to write a function to replace [] with no character at all?
If I do:
#Interface variable match:
match='0/7'
Then I execute it and I get a match. So it seems the issue is that [] character still on the interface "match" variable. But when I converted it to string, I thought it would go away. Do you agree I need to replace the [] with no characters here?
Original data from appliance, dictionary:defaultdict(<class 'list'>, {'PSE2': ['0/7/CPU0', '1/0/CPU0', '1/2/CPU0']})
Printing original interface value=['0/5']
type of values v <class 'str'> ['0/7/CPU0', '1/0/CPU0', '1/2/CPU0'] and type of interface:<class 'str'> ['0/5']
Now printing manually assigned value to match interface: 0/7
**** FINALLY FOUND IT ****
Original data from appliance, dictionary:defaultdict(<class 'list'>, {'PSE2': ['0/7/CPU0', '1/0/CPU0', '1/2/CPU0']})
Printing original interface value=['0/7']
type of values v <class 'str'> ['0/7/CPU0', '1/0/CPU0', '1/2/CPU0'] and type of interface:<class 'str'> ['0/7']
Now printing manually assigned value to match interface: 0/7
**** FINALLY FOUND IT ****
exit...
I see we replied at the same time.
Sure I understand the problem now.
I no longer convert the dictionary values 'v' into a string.
Then it is obvious the interface value 'match' is still showing:
Printing original interface value=['0/7']
So can you tell me again your thoughts if it is needed to write a function to replace [] with no character at all?