Hi all…how to get index of two List in the picture?
Thank you…
Are they always at position 2 and 3?
1 Like
What exactly are you wanting to do? You’re already getting the index of each item. Can you show us what your expected outcome would be?
1 Like
Hi @Eng.Minh,
Welcome to the Dynamo community.
Try copy-pasting the code as shown below into a Python node in your graph.
IndexOf (No Repeat).dyn (5.4 KB)
OUT = []
for i,x in enumerate(IN[1]):
allIndices = [j for j,y in enumerate(IN[0]) if y == x]
if allIndices:
try:
k = IN[1][:i].count(x)
OUT.append(allIndices[k])
except:
OUT.append(allIndices[-1])
else:
OUT.append(-1)
1 Like
Thank you for reply
I have a list 1 of equipments; List 2 is a list point of equipment; List 3 is a new list point.
I want sort list 1 equal list 3
@Eng.Minh Just swap the inputs on Python node.
1 Like
Thannk you very much
1 Like