Search code snippets, questions, articles...

Join two tuples in python

A tuple is a python collection that is ordered and you can not change it. If you want to merge two tuples into a single tuple, you can use the code examples listed here.
tuple1 = (1, 2, 3, 4)
tuple2 = (5, 6, 7, 8)

tuple3 = tuple1 + tuple2
print(tuple3)
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place.
Output
(1, 2, 3, 4, 5, 6, 7, 8)

Output

(1, 2, 3, 4, 5, 6, 7, 8)

If you want to concatenate or join two tuples in python you can use the '+' keyword and it will provide you the new list which will contain items of both tuples.

Was this helpful?
0 Comments