Hello,
my code works fine:
strings = IN[0]
OUT = ",".join(strings)
when i try to make the same in a list of lists it does not work:
strings = IN[0]
OUT = []
for x in strings:
for i in x:
OUT.append(",".join(i))
#desired result:
1,2,1
4,5,3
0,2,3
You are appending the result into a flat list.
Append to a new list defined in the outer loop, then after finishing the inner loop append the outer loop to the result.
Generally speaking you should try to keep OUT as a static variable, and not define it twice.
@Draxl_Andreas Or you can use list comprehension by always converting the input to a nested list
toNestList = lambda x: x if any(isinstance(i, list) for i in x) else [x]
OUT = [",".join(x) for x in toNestList(IN[0])]