Sequences have a method index(value)
which returns index of first occurrence – in your case this would be verts.index(value)
.
You can run it on verts[::-1]
to find out the last index. Here, this would be len(verts) - 1 - verts[::-1].index(value)
More Related Contents:
- Search list for number in range
- Is there a short contains function for lists?
- Finding index of an item closest to the value in a list that’s not entirely sorted
- Find an element in a list of tuples
- Most efficient way for a lookup/search in a huge list (python)
- Fastest way to search a list in python
- Find starting and ending indices of sublist in list
- How do i search for 2 of the same numbers in a list? (python) [closed]
- How to remove an element from a list by index
- List of lists changes reflected across sublists unexpectedly
- How can I compare two lists in python and return matches
- TypeError: ‘list’ object is not callable in python
- Difference between del, remove, and pop on lists
- Pythonic way to check if a list is sorted or not
- Python: Finding differences between elements of a list
- List comprehension vs. lambda + filter
- Append to a list defined in a tuple – is it a bug? [duplicate]
- String to list in Python
- How to extract parameters from a list and pass them to a function call [duplicate]
- Generate a list of datetimes between an interval
- case-insensitive list sorting, without lowercasing the result?
- Python AND operator on two boolean lists – how?
- Converting a list of tuples into a dict
- Python Array Slice With Comma?
- How to convert list of tuples to multiple lists?
- Python: find closest string (from a list) to another string
- In Python, how do you find the index of the first value greater than a threshold in a sorted list?
- How to override the slice functionality of list in its derived class
- How do I reverse a list using recursion in Python?
- Nested lambda statements when sorting lists