I've two list
a = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0]
b = [4,4]
and the list may be like this as well
a = [1, 1, 1, 4, 1, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0]
b = [1,4]
and i need the index position in the list a for the value which is there in list b
My Expected output should( These are index position of the value)
output-
1. [0,1]
2. [0,3]
This code is giving all index value where it matches
c_set = set()
res = []
for idx, val in enumerate(test_list):
if val not in oc_set:
oc_set.add(val)
else:
res.append(idx)
but i need the lenght of index value as list b, as i mentioned in my expected output.
Thanks in Advance