In this article, we are going to learn how to join tuple elements in a list. It's a straightforward thing using join and map methods. Follow the below steps to complete the task.
# initializing the list with tuples string_tuples = [('A', 'B', 'C'), ('Tutorialspoint', 'is a', 'popular', 'site', 'for tech learnings')] # function that converts tuple to string def join_tuple_string(strings_tuple) -> str: return ' '.join(strings_tuple) # joining all the tuples result = map(join_tuple_string, string_tuples) # converting and printing the result print(list(result))
If you run the above code, then you will get the following result.
['A B C', 'Tutorialspoint is a popular site for tech learnings']
If you have any queries in the article, mention them in the comment section.