Dynamo to python script process

Very good days.
Well this time I have the following question.
I frequently have to perform vector comparisons, obtain indexes, filter them, clean them, etc. “I SHOW A PICTURE”
Well, what I’m trying to learn is how to replicate the DYNAMO graph in code sequence in PYTHON SCRIPT in a simple way that I can understand the process that each method has.
I’m learning PYTHON and I’m trying to do it with small snippets of code that are frequent for me…
I greatly appreciate your support and time.


03_COD IN PYTHON.dyn (16.7 KB)

Hello,
if that helps, unless you’re looking for a 100% Python solution

edit:
beginner python result

import sys

lst_source=IN[0]
lst_test=IN[1]

#Container
Index_recup=[]
out=[]
#Code created by a beginner
for i in lst_test:
    for idx,j in enumerate(lst_source):
        if i==j:
            Index_recup.append(idx)
Index_recup.sort() #Put in ascending order

out=[lst_source[k] for k in Index_recup]

OUT = out

cordially
christian.stan

3 Likes

Could you help me by first obtaining the indexes as the first step and then proceeding to obtain the elements through the indexes, this would help me a lot to be able to understand the code better, here I leave a somewhat more specific example.
In this case I have a list with several sublists
Thank you so much.


00_Consulta de Indices y GetIndex.dyn (16.8 KB)