-
Notifications
You must be signed in to change notification settings - Fork 0
list
PingpingPapa edited this page Mar 6, 2022
·
4 revisions
- sort(): Sorts the list in ascending order.
- type(list): It returns the class type of an object.
- append(): Adds one element to a list.
- extend(): Adds multiple elements to a list.
- index(): Returns the first appearance of a particular value.
- max(list): It returns an item from the list with a max value.
- min(list): It returns an item from the list with a min value.
- len(list): It gives the overall length of the list.
- clear(): Removes all the elements from the list.
- insert(): Adds a component at the required position.
- count(): Returns the number of elements with the required value.
- pop(): Removes the element at the required position.
- remove(): Removes the primary item with the desired value.
- reverse(): Reverses the order of the list.
- copy(): Returns a duplicate of the list.
list_a = [1, 1, 1, 2, 3, 4, 5, 6]
print(list_a.index(1))
array.sort(key = lambda x:x[0])
print(array)
>>>>> [[30, 'banana'], [50, 'apple'], [400, 'melon']]
#기준이 여러 개일 경우
lst.sort(key = lambda x: (-x[1], x[2], -x[3], x[0]))