'Merge column into one string from 2D list

I want to merge one column into one string from 2D list. Are there better ways to merge it?

lists = [['H', 'W'], ['e', 'o'], ['l', 'r'], ['l', 'l'], ['o','d']]
str1 = ''
str2 = ''
for i in lists:
    str1 += i[0]
    str2 += i[1]
print(str1, str2) #('Hello', 'World')


Solution 1:[1]

Another option is to use zip and str.join in a loop:

out = [''.join(tpl) for tpl in zip(*lists)]
print(*out)

Output:

Hello World

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1