python learning the syntax commonly used in recording

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/sgl520lxl/article/details/81566451

List (list) related

= Li [1,2,3,4,5,6]

# 1. Remove the target element using the corresponding lower del
del Li [2]
# Li = [1,2,4,5,6]

# 2. Use .pop () delete the last element
li.pop ()
# Li = [1,2,4,5]

# 3. remove the specified values of the elements
li.remove (. 4)
# Li = [1, 2,5]

 

Tuple (tuple) related

 

Tuple split examples:

 

 

Guess you like

Origin blog.csdn.net/sgl520lxl/article/details/81566451