对 字符串/列表/元组/数列 等数据按固定单元长度分组
Project description
一个用来对 字符串/列表/元组/数列 等数据按固定单元长度分组的功能:
from skybox import cut_data
# 分字符串
data = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
cut_data(data, 3) # >>> ['ABC', 'DEF', 'GHI', 'JKL', 'MNO', 'PQR', 'STU', 'VWX', 'YZ']
# 分列表
data = ['赤', '橙', '黄', '绿', '青', '蓝', '紫']
cut_data(data, 3) # >>> [['赤', '橙', '黄'], ['绿', '青', '蓝'], ['紫']]
# 分元组
data = ('赤', '橙', '黄', '绿', '青', '蓝', '紫')
cut_data(data, 3) # >>> [('赤', '橙', '黄'), ('绿', '青', '蓝'), ('紫',)]
# 分数列
data = range(1, 15)
cut_data(data, 3) # >>> [range(1, 4), range(4, 7), range(7, 10), range(10, 13), range(13, 15)]
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
skybox-2024.2.25.tar.gz
(6.5 kB
view details)
Built Distribution
File details
Details for the file skybox-2024.2.25.tar.gz
.
File metadata
- Download URL: skybox-2024.2.25.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94e5aac9b863b93063ee6b6dee22153e75bc8dc2f195ec04ad71a7647c44146f |
|
MD5 | ea072dd26757ffc37441cd967d6418ee |
|
BLAKE2b-256 | 69a1df0dbc534b786b91912a8fc9b868f4f0559df8010003aefcb9a42273de08 |
File details
Details for the file skybox-2024.2.25-py2.py3-none-any.whl
.
File metadata
- Download URL: skybox-2024.2.25-py2.py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c698efe36df7fc28a4c9f03366a49bbed5bb2d3e95000de86a088635b5bb6ec8 |
|
MD5 | b4a6196fe1cb12cb7f5305d44a15b3a7 |
|
BLAKE2b-256 | 05ed9ad723da0ec14547d9c0301337fd4f3437146b4f07ccf961f82a71433a8b |