Convert Tuple to String in Python

Here are two ways to convert a tuple to a string in Python.

Note that if your tuple contains numeric data (such as integers), you’ll need to apply a different code (point 2 below), where you first convert each element in the tuple to a string.

(1) Convert a tuple that contains text to a string:

my_tuple = ("aa", "bb", "cc", "dd", "ee")

my_string = "".join(my_tuple)

print(my_string)

The result is a string:

aabbccddee

(2) Convert a tuple that contains numeric values (or text values) to a string:

my_tuple = (1, 2, 3, 4, 5)

my_string = "".join([str(i) for i in my_tuple])

print(my_string)

The result is a string:

12345

Additional guides:

Leave a Comment