List Methods

 0    12 fiche    sir
ladda ner mp3 skriva ut spela Kontrollera dig själv
 
Fråga Svar
Adds an item to the end of the list.
börja lära sig
. append()
Adds an item at the specified index.
börja lära sig
. insert()
Removes the specified item.
börja lära sig
. remove()
Removes the specified index, (or the last item if index is not specified).
börja lära sig
. pop(i'index)
Keyword which, removes the specified index, whole list, variable or function.
börja lära sig
del
Method which empties the list.
börja lära sig
. clear()
You can make a copy of a list with the this method.
börja lära sig
list2 = list1. copy()
Usethis method to add list2 at the end of list1.
börja lära sig
list1. extend(list2)
Returns the index of the first element with the specified value
börja lära sig
. index(value)
Reverses the order of the list.
börja lära sig
. reverse()
Sorts the list.
börja lära sig
list. sort(reverse=True|False, key=myFunc)
Returns the number of times a specified value occurs in a list.
börja lära sig
. count()

Du måste vara inloggad för att skriva en kommentar.