Python_00_Python tuples

    1. Definition of tuples: tuple list similar However, the data within the tuples can not be changed

    2. Statement tuples: T = (l, 2,3)

      Note: tuple defining a plurality of elements, separated by commas middle, but the need to add a comma at the end of the definition of a tuple element, will not be added if not defined as a tuple

 

     3. tuple lookup:

      1) Press the standard look: the list is the same

      2) index () list with the same

      3) count () with the same list

      4) len () list with the same

     4. Modify the tuple , although not modify the content of the tuple, but if there exists a list, it is also possible to modify

      例如:tuple1=(1,2,["a","b","c"],3,66)

      tuple[2][0]="aaa"

      print(tuple) # tuple1=(1,2,["aaa","b","c"],3,66)

Guess you like

Origin www.cnblogs.com/tkg1314/p/12520574.html