Skip to content

How to find last index of list in Python?

# To get the last element in a list you use -1 as position
bikes = ['trek', 'redline', 'giant']
bikes[-1]
# Output:
# 'giant'
See also  Python code snippet - pandas How to start read csv at a certain row?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.