List Methods

 0    12 fiche    sir
laste ned mp3 Skriv ut spille sjekk deg selv
 
spørsmålet svaret
Adds an item to the end of the list.
begynn å lære
. append()
Adds an item at the specified index.
begynn å lære
. insert()
Removes the specified item.
begynn å lære
. remove()
Removes the specified index, (or the last item if index is not specified).
begynn å lære
. pop(i'index)
Keyword which, removes the specified index, whole list, variable or function.
begynn å lære
del
Method which empties the list.
begynn å lære
. clear()
You can make a copy of a list with the this method.
begynn å lære
list2 = list1. copy()
Usethis method to add list2 at the end of list1.
begynn å lære
list1. extend(list2)
Returns the index of the first element with the specified value
begynn å lære
. index(value)
Reverses the order of the list.
begynn å lære
. reverse()
Sorts the list.
begynn å lære
list. sort(reverse=True|False, key=myFunc)
Returns the number of times a specified value occurs in a list.
begynn å lære
. count()

Du må logge inn for å legge inn en kommentar.