Skip to main content

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.

https://travis-ci.org/nkantar/Keysort.svg?branch=master https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg

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

Keysort-0.1.2.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Keysort-0.1.2-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file Keysort-0.1.2.tar.gz.

File metadata

  • Download URL: Keysort-0.1.2.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

Hashes for Keysort-0.1.2.tar.gz
Algorithm Hash digest
SHA256 17a8134f79375d45e9be91db7e3d4572d261ce3503b126aba6a728df73104c5e
MD5 b24c5cf6d2b0fce568b43d7d92397209
BLAKE2b-256 d68b5d5d6b1f1effdadd9570d72127dd36774cd05f30f8a8493739893236d31c

See more details on using hashes here.

File details

Details for the file Keysort-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: Keysort-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.1 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

Hashes for Keysort-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 64113da3fe0ed78f6f2fcbaac2b1420d939ee03826b6f8abeb29290c8195308e
MD5 07da778ed6af4c3dd570ea894b692f0d
BLAKE2b-256 a945e684b41977466d4649ea1f339863870738fef695316c273e9d77e51f9b73

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page