Tuples, like lists, are also a sequence, and learning tuples requires two points: (1) tuples cannot be modified, so someone calls it "read-only List" (2) a comma in a tuple is important.
First, we create a tuple, which is as simple as separating some values with commas and automatically creating a tuple. Note that there is only one element when you need to add a comma.
>>> 1,2,3,4,5,6(1, 2, 3, 4, 5, 6)>>> 3, (3,)
Second, let's look at the conversion between different formats
>>> tuple ([1,2,3,4,5,6]) # list Conversion Narimoto Group (1, 2, 3, 4, 5, 6)>>> tuple (' ABC') # string Conversion narimoto group ('a' ) b ' ' C ')
Ganso Other basic operations can refer to the list, then we learn the meaning of Ganso?
(1) A tuple can be used as a key in a member of a map and a collection, but the list cannot be
(2) tuple as the return value of the built-in functions and methods
Python Series Tutorials (ii) read-only lists-tuples