here is the code:-
array1 = [["a","b","c"] ,['e','f','g'] , ['i','j','k']]
array2 = ['d' , 'h']
array1 = [a+list(b) for a,b in zip(array1,array2)]
print(array1)
I want the desired output [["a","b","c", "d"] ,['e','f','g','h'] , ['i','j','k']] but the code gives the optput [['a', 'b', 'c', 'd'], ['e', 'f', 'g', 'h']].
This is happening because there is nothing to add to in array1[2], how to overcome this situation,
I tried using a = [a+list(b) if b else a for a,b in zip(array1,array2)]
but there was no change please help.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…