Could somebody please tell me how can I merge the following list:
[[['a', 'b'], ['b', 'a'], ['c', 'c']], [['d', 'e'], ['e', 'd']]]
into:
[['ab', 'ba', 'cc'], ['de', 'ed']]?
Thank you!
>Solution :
IIUC, you need to map the join on all the sublists:
l = [[['a', 'b'], ['b', 'a'], ['c', 'c']], [['d', 'e'], ['e', 'd']]]
out = [list(map(''.join, x)) for x in l]
Or:
out = [[''.join(i) for i in x] for x in l
Output: [['ab', 'ba', 'cc'], ['de', 'ed']]