Putting a Value to Empty Lists

Firstly its been a while since I posted on here so its good to see so many new faces picking up dynamo.

I’ve recently hit a stumbling block with one of my workflows and would be grateful for any help. If I have a list of say 50 items but at certain indexs’ (these numbers can alter depending upon the results) it gives me an empty list, which is correct. If I wanted to extract all these empty lists and fill in a string value of N/A as an example how could I go about doing this? I’m thinking I may need to do this function in python as the standard List.Filters, ReplaceByCondition and IfEqualReturnIndex don’t work with empty lists. Thanks in advance…

Empty List

I have a custom node List.ReplaceItemAtIndex in package Clockwork that will do this for replacing one item.

Altering it slightly, one could use it on a list of indices, like so:

thelist = IN[0]
thereplacement = IN[1]
indices = IN[2>]
for index in indices: thelist[index] = thereplacement
OUT = thelist

I’ll include this in the next version.