Python Tuples

A tuple is similar to a list except that it is fixed-length and immutable. So the values in the tuple cannot be changed nor the values be added to or removed from the tuple. Tuples are commonly used for small collections of values that will not need to change, such as an IP address and port. Tuples are represented with parentheses instead of square brackets:

ip_address = ('', 8080)


The same indexing rules for lists also apply to tuples. Tuples can also be nested and the values can be any valid

Python valid.

A tuple with only one member must be defined (note the comma) this way: 

one_member_tuple = ('Only member',


one_member_tuple = 'Only member', # No brackets 

or just using tuple syntax 

one_member_tuple = tuple(['Only member'])