Hi guys, I am having trouble replacing certain items in a list. In the example shown below, I am trying to replace items in List2 if the same item in index [0] of List1 is found. Appreciate your help!
Easy with Python
data=IN[0]
dataFirst=IN[1]
replacement=IN[2]
FirstList=IN[3]
a=[]
b=[]
for ind, item in enumerate (dataFirst):
try:
a.append(FirstList.index(item))
b.append(ind)
except:
pass
for i,j in zip(a,b):
data[j]=replacement[i]
OUT=data
1 Like
Hi salvatoredragotta, it works! Thanks a lot!
1 Like
@kmakCX9NP Please mark the post as solved
Hi salvatoredragotta, I see that your post is marked “Solution” with a check mark. Is there anything else I need to do? Thanks for your help again!
1 Like
Thanks!