This library has a function to split the data list into several small sections
Project description
List Slicer
This library has a function to split the data list into several small sections
Usage
Use the following code to split your list data
Split List data
from listslicer.slicer import Slicer
#My list data
data = [
200, 1230, 15, 2200, 5550
]
#2 is amount to split
data_slice = Slicer.cut(data, 2)
print(data_slice)
Result
[[200, 1230], [15, 2200], [5550]]
Example to split Dictionary
data = [
{
"foodname": "Ayam Bakar",
"price": 12000
},
{
"foodname": "Jus Mangga",
"price": 7000
},
{
"foodname": "Mie Goreng",
"price": 9000
},
{
"foodname": "Chicken Katsu",
"price": 15000
},
]
print(slicer.cut(data, 2))
Result
[
[{'price': 12000, 'foodname': 'Ayam Bakar'}, {'price': 7000, 'foodname': 'Jus Mangga'}],
[{'price': 9000, 'foodname': 'Mie Goreng'}, {'price': 15000, 'foodname': 'Chicken Katsu'}]
]
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
list-slice-1.0.0.tar.gz
(2.4 kB
view details)
File details
Details for the file list-slice-1.0.0.tar.gz.
File metadata
- Download URL: list-slice-1.0.0.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfbb63974275feb3a5bbe034e5f44480a7b6ec0caf584ec0c01c54890862ef46
|
|
| MD5 |
9f6a7c67636d95d2ad78bfaf40342bd8
|
|
| BLAKE2b-256 |
94630a47868b661d3c7c9dde679299f72f7d99e6d900b9ae1a578667ffe60264
|