Python Tutorial

Changing and Deleting Tuple Item Values

How to Change or Delete Tuple Item Values in Python?

Tuples are immutable, therefore you can't remove or change items from them. However, you may use the same workaround we used to add and change tuple items. 


Convert the tuple into a list, remove "cranberry", and convert it back into a tuple:

thist_uple = ("c", "b", "a")

y = list(this_tuple)


this_tuple = tuple(y)


('b', 'a')


The del keyword can delete the tuple completely:

this_tuple = ("c", "b", "a")

del this_tuple

print(this_tuple) #this will raise an error because the tuple no longer exists

Did you find this article helpful?