python list中的最后一个元素
# To get the last element in a list you use -1 as position
bikes = ['trek', 'redline', 'giant']
bikes[-1]
# Output:
# 'giant'
获取每个项目,但python列表的最后一个项目
x = [1, 2, 3, 4]
#same array, but the last item.
notLast = x[0:-1]
python列表的最后一个元素
# to print the last item from a list
print(list[-1])