If I have the following lists:
a = ['a','b','c']
b = ['1','2','3']
How can I get python to output this:
['a',1,'b',2,'c',3]
Thanks in advance !!
If I have the following lists:
a = ['a','b','c']
b = ['1','2','3']
How can I get python to output this:
['a',1,'b',2,'c',3]
Thanks in advance !!
Try this:
a = ['a', 'b', 'c']
b = ['1', '2', '3']
c = []
for x, y in zip(a, b):
c.append(x)
c.append(y)
print (c)
output:
['a', '1', 'b', '2', 'c', '3']
Of course you can change it to match your needs, if needed