Small turtle thirteenth and after-school summary

8. Write down what you learn this lesson: The free-form, memories and repeat is a good way to strengthen memories!
Ganso is to be created by (), and when the reference is the same with []

比如:temp[1],就是找1的值

Tuples: immutable
way to access a list of tuples is no different from
the iconic symbol of tuples not parentheses, but the comma, so the tuple contains only one element, you need to add a comma after the element
can be tuples operator operation:
splicing operators: +
repetition operators: *
members operator: in / not in
relational operators:> <
logical operators: and or
splice
element value tuple can not be modified, but we You may be connected to a combination of the tuple

Element values ​​in the tuple can not be deleted, but we can use the del statement to delete an entire tuple

Practical in daily use, rarely use del to delete the entire tuple, because Python's recovery mechanisms will be automatically deleted tuple no longer used to the time.

Built-in functions tuples:
element comparison of two tuples: operator.eq (temp1, temp2) (provided for an import operator)
calculates the number of tuples of elements: len (temp1)
Returns the maximum value tuple element: max (temp1 )
returns the minimum value tuple elements: min (temp1)
the list into tuples: tuple (list1)
method tuple:
index: this method returns a parameter tuple position
count: this method is used to calculate a number of parameters that appear in the tuple

Author: Innocence villains
link: https: //www.jianshu.com/p/c59def787e66
Source: Jane books
are copyrighted by the author. Commercial reprint please contact the author authorized, non-commercial reprint please indicate the source.

Published 17 original articles · won praise 1 · views 360

Guess you like

Origin blog.csdn.net/cccccccaaaaaaaaa/article/details/105248023