📅  最后修改于: 2022-03-11 14:47:12.949000             🧑  作者: Mango
l = [1,2,5,9,7,4,5]
# what are you referring to?
# 1) l[-1] is the last element of list
print(l[-1])
>>> 5
# 2) l[:-1] returns all the elements of the list but the last one
print(l[:-1])
>>> [1,2,5,9,7,4]