Here's one way zipping the sublists and mapping with ''.join
the resulting tuples:
list(map(''.join, zip(*lst)))
# ['a@1', 'b$2', 'c#3']
Here zip
as shown in the docs aggregates elements from several iterables. With *
, we are unpacking the list into separate iterables, which means that the function will instead be receiving zip(['a','b','c'],['@','$','#'],['1','2','3'])
.
Now at each iteration, map
will be applying ''.join
to each of the aggregated iterables, i.e to the first element in each sublist, then the second, and so on.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…