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']
# Output:
# 'giant'
See also  Python code snippet - How to change order of attributes of an element using beautiful soup?

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.