arraylist - Python: concatenate 2 list -
i have 2 lists in python:
list1 [1,1,0,0,1,1,0,0,1,1] list2 [a,b,c,d,e,f,-,-,-,-]
i output follow:
output
[a,b,-,-,c,d,-,-,e,f]
i lost, tried multiple things without luck. have idea how it? here's try:
for e in range (0, len(stringas)): if controllo[e] == "1": memoria.append(stringas[e]) if controllo[e] == "0": memoria.append("-") blocco.append(e) salva.append(stringas[e]) print (stringas) print (memoria) f in salva: print (blocco[c]) print (salva[c]) memoria.insert(blocco[c], salva[c]) c = c + 1
thank in advance.
try this:
output = [list2.pop(b-1) b in list1]
Comments
Post a Comment