三种办法获取 Python 列表最初一个元素
>>> list1 = [1, 2, 3, 4, 5]
>>> print(list1[len(list1)-1])
5
>>> print(list1[-1])
5
>>> print(list1.pop())
5
>>>
参考:
how to get last element of a list in python
三种办法获取 Python 列表最初一个元素
>>> list1 = [1, 2, 3, 4, 5]
>>> print(list1[len(list1)-1])
5
>>> print(list1[-1])
5
>>> print(list1.pop())
5
>>>
参考:
how to get last element of a list in python