Getting the last element of a list

后端 未结 12 1478
一向
一向 2020-11-22 04:58

In Python, how do you get the last element of a list?

12条回答
  •  星月不相逢
    2020-11-22 05:49

    Ok, but what about common in almost every language way items[len(items) - 1]? This is IMO the easiest way to get last element, because it does not require anything pythonic knowledge.

提交回复
热议问题