Getting sublist in single line comma seperated

i am getting lost here and think this needs some Python

the out put of the list needs to be
0 Bush
1 Female, Standing, Adult
2 Female, Adult, Sitting
3 Sport

there can be up to 9 sublist inputs
i know the empty list at the if statement can be solved… but to make 9 list.filterbyboolmask is a bit clumpsy.

anyone got an idea…

Look into the string.join node in Dynamo, it should be able to join strings with a separator. Crumple has a similar node that uses Python and is also called string.join, which accepts levels unlike the ootb one.

i know the sting.join node… but the problem is that it needs to join the inputs from the sublist.
and as stated to make 9 or more bool filters with an equally long if statement to get to the string.join isn’t the way to go…

going from the sublist
2 list
0 Female
1 Standing
2 Adult

to

2 Female, Standing, Adult

that is the main problem


join with index.dyn (10.8 KB)

The node is from Crumple package.

2 Likes

hello
I’m late

cordially
christian.stan
03 aout forum anglais rep2.dyn (20.0 KB)

1 Like

thanks a lot guys… two beautiful solutions… think i will take chtistians approach because it doesn’t need additional packages and i need to share this graph with people

1 Like

I think my node just has one Python block in it. You’re welcome to copy it out as a Python block from the node if you find it easier, happy either way whichever you chose to use, although not sure the list index is being appended in Christian’s approach. Noting you’d need to add another level of looping to make it mimic @ Level 2 behavior though.

2 Likes

better way to go indeed

2 Likes

Hello
All roads lead to Rome (that’s the main thing, it’s true that I had forgotten a cobblestone)


I learned again today like every day

(the ; in a text string is a newline)

cordially
christian.stan

1 Like