Tuple, the first level element cannot be modified, cannot be added or deleted
Tu = (111, ' Alex ', (11,22), [(33,44)],ture,33,33,)
It is recommended to add a comma at the end to distinguish whether the tuple is not an error
can be called out
Tu = (111,'Alex', (11,22), [(33,44)],true,33,33= tu[1]print(v )
or slice
Tu = (111,'Alex', (11,22), [(33,44)],true,33,33= tu[1:3]print (v)
Tuples after a tuple is sliced or set
can be used for loop
Tu = (111,'Alex', (11,22), [(33,44)],true,33,33,) for in Tu: Print (item)
Lists and tuples can be converted to each other
Tu = (111,'Alex', (11,22), [(33,44)],true,33,33= list (TU)Print (v)
List = (111,'Alex', (11,22), [(33,44)],true,33,33= tuple (list) Print(v)
is a string, you can connect through join
Tu = ['dsgsdgs','fhdshdsfh','sdgasgdas ' '_'. Join (TU)print(v)
Tuples are ordered.
Take a value of 33, the first "0" is taken out (33,44), the second takes 33
Tu = (111,'Alex', (11,22), [(33,44)],true,33,33= tu[3][0][0]Print (v)
Second-level list elements can be modified
Tu = (111,'Alex', (11,22), [(33,44)],true,33,33,) tu[3][0] =Print( Tu
Two ways to set up a tuple
Count gets the number of occurrences of the specified element in the tuple
Index gets the specific position of a value, the leftmost priority
The Magic day12 of the Python tuple