A small utility for sorting lists of dictionaries by dictionary key
Project description
Keysort is small utility for sorting lists of dictionaries by dictionary key.
Examples
>>> from keysort import keysort
>>> my_list = [{'code': 'beta', 'number': 3},
{'code': 'delta', 'number': 2},
{'code': 'alpha', 'number': 0},
{'code': 'beta', 'number': 2},
{'code': 'charlie', 'number': 1}]
>>> keysort(my_list, ['code', 'number'])
[{'code': 'alpha', 'number': 0},
{'code': 'beta', 'number': 2},
{'code': 'beta', 'number': 3},
{'code': 'charlie', 'number': 1},
{'code': 'delta', 'number': 2}]
>>> keysort(my_list, ['number', 'code'])
[{'code': 'alpha', 'number': 0},
{'code': 'charlie', 'number': 1},
{'code': 'beta', 'number': 2},
{'code': 'delta', 'number': 2},
{'code': 'beta', 'number': 3}]
Install
pip install keysort
Contributing
Contributions of all sorts are welcome, be they bug reports, patches, or even just feedback. Creating a new issue or pull request is probably the best way to get started.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Project details
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 Keysort-0.1.3.tar.gz.
File metadata
- Download URL: Keysort-0.1.3.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
185c06aeea547dee20e99871855ade106a0e819f89d75eb4ac6a62eebda32000
|
|
| MD5 |
b58a40c99cd10d4b8a984be035009dea
|
|
| BLAKE2b-256 |
174f6a4e0d30cedc2524e141daa4802b6aa1a16553c0228f9ee44c29fdb6955a
|
File details
Details for the file Keysort-0.1.3-py3-none-any.whl.
File metadata
- Download URL: Keysort-0.1.3-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
474fd5b8dda1b4852b993445dcb86e082933b3c31bd2b45387d643ae7aa6428a
|
|
| MD5 |
b4fc62ff5e0a555406cdb3255d9e73a1
|
|
| BLAKE2b-256 |
f5494377432c16cb657ab123affa2ccf1bf41b80f194158576090bdd895e473c
|