Hi,
I am trying to extract the element and material details from the excel spreadsheet, and compare it with the existing model elements to set parameter to the selected element. I wanted to check the list using list.contains node before setting the parameter value. But, I am not sure what is wrong with my script, I am getting false outputs.
I tried manually entering the element name, it works. But, I would like to know the mistake with my first method.
There are no special characters. But I tried to copy the element name from the spreadsheet and tried in two different ways, one using the string node and other using the basic code block. In the first case, answer is false, but the second case gives me the right answer. I am wondering what’s the difference between the two as both the values is copied from the same file.
I am not pressing enter. I am trying to type in a single line, but when I finish it automatically splits the word. I tried to upload a snippet, but I couldn’t because of the file size.
Hi,
I know this may be a bit late but just wanted to discuss intersecting lists of different lengths.
Hope this is something that can help someone get to the desired list quicker.
These are the 4 ways I found you can do this depending on what you need.
a = IN[0]
b = IN[1]
d = []
#intersect and keep duplicates
for i in a:
for j in b:
if i == j:
d.append(j)
#intersect and exclude duplicates
c = (set(a) & set(b))
#find intersection of list1 and list2 and exclude duplicates
intersection_set = set.intersection(set(a), set(b))
intersection_list = list(intersection_set)
OUT = c,d,intersection_list