About 0x00
Tuple (tuple), which is equivalent to the immutable list. Tuples are defined by a comma-separated list of items in parentheses.
Features: 1, ordered set, 2, through the offset to fetch data, 3, belong to the immutable object, can not be modified in situ content, no sorting.
P.S. The immutable benefits of the tuple: ensuring data security, such as passing data to an unfamiliar method or interface, guarantees that the method or interface does not alter our data, which can lead to procedural problems.
0X01 Basic Operations
>>> A = (all in a) # definition >>> a[0]1>>> A[1:3] # slices (2,3)
>>> B = (,) #当元组中只包含一个元素时, you need to add a comma after the element to disambiguate
The purpose of modifying tuples can be achieved by overriding the values
>>> a = (a) >>> B = List (a) # changes a non-modifiable tuple to a list that can be modified >>> b[0] = 4 >>> a = tuple (b)>>> A (4,2,3)
Python Basics: Tuple