Replace Various Items with Various Index in the sublist

dynamo

#1

Hello everyone,

Do you know how I can use " ListReplaceitematIndex" tool in a way that it matches the value from another list and replace the corresponding number in another list? Thank you very much in advance.


#2

Try ReplaceItemAtIndex+ from Clockwork.


#3

@NLDaniel
This might be your cup of tea…


#4

I swear this is like the 10th replace python script I have made this week.


replaceAnything.dyn (4.3 KB)

This should take the type of inputs you showed but just in case it also has a recursive feature, meaning any size list it will check all the elements within it.


#5

:rofl:
I’ve seen a ton of these as well, and yet I still couldn’t properly create some of these myself.


#6

Thank you very much @kennyb6 it is exactly what I was looking for. I appreciate it.:grinning:


#7

Thank you for your input I tried with that tool but couldn’t replace multiple elements at once.

@kennyb6 provide the script which does so. Now it works.


#8

I see what you’re doing now. You actually want a dictionary, since you have specific values determined by items in your list. You can use a dictionary to convert all items to their intended values, then use a check to replace any nulls (values not in the dictionary) with their original value.


#9

Thank you @Nick_Boyts this seems like a good solution as well. I wanted to try this but couldnt find the “Springs.Dictionary.ByKeysValues” Nood amoung my packages. Could you tell me which one I should download it?

Thank you very much in advance.


#10

Look for the “Springs” package. :wink:


#11

Thank you @PauLtus now I have the nood, It is working as fine as well :grinning:


#12

@genovag sorry ik didn’t help my ispn has Someren trouble but ik see you have a solution