对 字符串/列表/元组/数列 等数据按固定单元长度分组
Project description
一个用来对 字符串/列表/元组/数列 等数据按固定单元长度分组的功能:
from skybox import sky_box
# 分字符串
data = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
sky_box(data, 3) # >>> ['ABC', 'DEF', 'GHI', 'JKL', 'MNO', 'PQR', 'STU', 'VWX', 'YZ']
# 分列表
data = ['赤', '橙', '黄', '绿', '青', '蓝', '紫']
sky_box(data, 3) # >>> [['赤', '橙', '黄'], ['绿', '青', '蓝'], ['紫']]
# 分元组
data = ('赤', '橙', '黄', '绿', '青', '蓝', '紫')
sky_box(data, 3) # >>> [('赤', '橙', '黄'), ('绿', '青', '蓝'), ('紫',)]
# 分数列
data = range(1, 15)
sky_box(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.3.31.tar.gz
(7.3 kB
view details)
Built Distribution
File details
Details for the file skybox-2024.3.31.tar.gz
.
File metadata
- Download URL: skybox-2024.3.31.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 424f27eeb535283c424fbf2197bda7c1c1b046ead790f5569d5f863c660f064f |
|
MD5 | e710acdfe3d6ad0a97411ee72a9195b4 |
|
BLAKE2b-256 | 2a489f2cc30056d33989652b6ba855678f4b15b449546da66bc35680ccf2472d |
File details
Details for the file skybox-2024.3.31-py2.py3-none-any.whl
.
File metadata
- Download URL: skybox-2024.3.31-py2.py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71315db1733f0128c0f9f1383c96ea391ca8544db0a565fe181b0dae685a785e |
|
MD5 | 5f85ec9bd211df8e6ab48535db60f270 |
|
BLAKE2b-256 | d8e2dd774c7638fbc2ea50eebae64489efc7950ddc883b935b20354185077d35 |