# Concate lists, how?

Hello,

I try some python stuff, how can i combine lists f.e.:

A,B,C,… with 1,2,3 to A-1,B-2,C-3,…

``````# Phython-Standard- und DesignScript-Bibliotheken laden
import sys
import clr
from Autodesk.DesignScript.Geometry import *

def conc (x,y):
total = x + "-" + y;

val = []

for x,y in zip(IN[0],str(IN[1])):
val.append(conc(x,y))

OUT = val
``````

with numbers it worked very well (to sum up) but how can i deal with “strings”

KR

Andreas

Any reason you can’t use the string.concat node? does this have to be within python?

1 Like

You need to see from what level the data is coming.
So, instead of IN[0] it would have to be IN[0][0]

Try this

``````def conc (x,y):
total = x + "-" + y;

val = []

for x,y in zip(IN[0][0],IN[1][0]):
val.append(conc(x,str(y)))

OUT = val``````
2 Likes

the list.combine combines the list using string.concat as a rule, with the hyphen string placed in the middle.

1 Like

yes i could, but i learn python

1 Like

even that works!

I understand, the brackeds are essential for list-Depth

1 Like