listrindex
A lightweight Python utility that allows you to find the last index of an element in a list — something the built-in list.index() method does not support.
📌 Description
In Python, list.index(x) returns the first index of x in a list.
The listrindex class provides the method rindex(list, object) that returns the last index where the object appears.
This is especially useful when working with large datasets or when you want to find the last occurrence of repeated elements.
✅ Features
- Returns the last index of a given value in a list.
- Works with integers, strings, or any data type.
- Raises
ValueErrorif the element is not found, just likelist.index().
🧪 Usage
from listrindex import listrindex
mylist = [5, 3, 7, 3, 9, 3]
value = 3
r = listrindex()
print(r.rindex(mylist, value)) # Output: 5 (last index of 3)
Release files for listrindex 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| listrindex-0.1.tar.gz | 1.8 kB | Details |
Release files / listrindex-0.1.tar.gz
| Download URL | listrindex-0.1.tar.gz |
|---|---|
| Size | 1.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1106000274a877dabd21f7b5f68bf7fbd4fbdd4d52dbab1b16016f3ef84738f9
|
|
BLAKE2b-256 checksum How to use checksums |
e443c723cb7cab1cd6761d17063250bd8cf8950096d292a26060804c336d09dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|