PriymakVl
3/12/2020 - 4:32 AM

python list method function

python list method function

#
num = [3, 7, 10, 7]

#add item in end list
num.append(23)

#clear list
num.clear()

#copy all
a = num.copy() 
a = num[:]

#count same item 
num.count(7)

#get index item
num.index(10)
num.index(10, 3)
num.index(10, 3, 5)
# 3, 5 interval

#insert item
num.insert(2, 43)
# where 2 - index

#delete last item and return it
num.pop()

#delete item by it of index
num.pop(1)

#delete by value of item
num.remove(7)
# deleted only first item

#reverse list
num.reverse()

#sort
num.sort()
num.sort(reverse = true)