A Python package for common list operations such as removing duplicates and flattening lists.
Project description
List Utilities
List Utilities is a simple Python package that provides utility functions for common list operations, including removing duplicates and flattening nested lists.
Installation
You can install the package using pip:
pip install list_utilities
Functions Descriptions
First Function: remove_duplicates(input_list) Description: This function takes a list as input and returns a new list that contains the unique elements from the original list, preserving their original order. It effectively removes any duplicate entries without altering the sequence of the remaining items.
Parameters: input_list (list): A list of elements from which duplicates need to be removed. The elements can be of any data type (e.g., integers, strings). Returns:
(list): A list containing only unique elements from the input_list.
Example:
from list_utilities import remove_duplicates
my_list = [1, 2, 2, 3, 4, 4, 5] unique_list = remove_duplicates(my_list) print(unique_list)
Output:
[1, 2, 3, 4, 5]
Second Function: flatten_list(nested_list) Description: This function flattens a nested list, which may contain other lists at any level of depth, into a single list. It recursively traverses through all elements and sub-elements, collecting them into a single flat structure.
Parameters:
nested_list (list): A list that may contain other lists as elements. The nesting can be at multiple levels. Returns:
(list): A single list that includes all elements from the nested_list, with no nesting. Example:
from list_utilities import flatten_list
nested = [[1, 2], [3, 4, [5, 6]], 7] flat = flatten_list(nested) print(flat)
Output:
[1, 2, 3, 4, 5, 6, 7]
License This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file list_utilities-0.1.1.tar.gz.
File metadata
- Download URL: list_utilities-0.1.1.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e651bfe17d8b691739c689badd232dd07315efcbd509756ac8989e1f9db6287
|
|
| MD5 |
d7a77e0a9ffe53777faafd9d3b5cfdc7
|
|
| BLAKE2b-256 |
c3649b947f08ae1c4fa8143f2a96dc09277620503393acbde5fa0299f74039c3
|
File details
Details for the file list_utilities-0.1.1-py3-none-any.whl.
File metadata
- Download URL: list_utilities-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
102d6b0302afef4346e46e0c3ab0b525f06c4c7a7b6fc8ab422faa5550d7d54d
|
|
| MD5 |
92889dd368c378d540ecda6332a1ae30
|
|
| BLAKE2b-256 |
e3b5a1f4d660c0555131703d0b51e0b04a607b01b2d0685cc30fe9da52b04b53
|