Skip to main content

Splits a list into sublists based on either a list of indices or a number of sections.

Project description

Splits a list into sublists based on either a list of indices or a number of sections.

Tested against Windows / Python 3.11 / Anaconda

pip install splitlistatindex

from splitlistatindex import list_split
l1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
l2 = [3, 5, 7, 8, 12]

# Split `l1` using a list of indices
result1 = list_split(l=l1, indices_or_sections=l2)
# result1 will be: [[0, 1, 2], [3, 4], [5, 6], [7], [8, 9]]

# Split `l1` into 3 sections
result2 = list_split(l=l1, indices_or_sections=3)
# result2 will be: [[0, 1, 2, 3], [4, 5, 6], [7, 8, 9]]

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

splitlistatindex-0.10.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

splitlistatindex-0.10-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file splitlistatindex-0.10.tar.gz.

File metadata

  • Download URL: splitlistatindex-0.10.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for splitlistatindex-0.10.tar.gz
Algorithm Hash digest
SHA256 9fdae4c6876ebf3389f45c5fba7aec91636ca8edaa35be5cc6ece96f77592dbf
MD5 3b977783095606e5af4f15c652e933db
BLAKE2b-256 108e674288673ac52e5fc287a710bfe38896593778b48f62440d10d470329341

See more details on using hashes here.

File details

Details for the file splitlistatindex-0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for splitlistatindex-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 bcb918098a187452651eead61367b61f86adc8c04c1c16317ae0bda12d921957
MD5 fda6c504db6e78fbec80eaf55579d08a
BLAKE2b-256 1af0a81c88442e4222d34efe6aec83dda78ccbd92188d875a8831bdd7728a2a1

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