delete something from the list

list1.remove('an element in the list')

del list1[i] delete the i-th element in the list del list1 delete list 1

list1.pop() takes the last element from the list and returns the value of that element list1.pop(index)

slice slice

list[1:3]    list1[ :3] list1[1: ]

list[ : ] copies a list


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325941734&siteId=291194637