可切片字典
项目描述
支持切片的字典。
Slict实现了Mapping,并接受[start]:[stop]索引来切片元组键的一维或多维。
Slict可以包装任何其他Python Mapping,并且轻量级(空间复杂度为O(1))。例如,可以与chest一起尝试。
示例
>>> from slict import Slict
>>> weather = Slict({("12pm", "Temperature"): 15., ("12pm", "Wind Speed"): 12.5,
... ("1pm", "Temperature"): 15.5, ("1pm", "Wind Speed"): 9.2})
>>> temps = weather[:,"Temperature"]
>>> for k in temps:
... print("The temperature at {:4s} is {:f}".format(k, temps[k]))
The temperature at 12pm is 15.000000
The temperature at 1pm is 15.500000
>>> noon_weather = weather["12pm",:]
>>> for k in noon_weather:
... print("The {:s} is {:f}".format(k, noon_weather[k]))
The Temperature is 15.000000
The Wind Speed is 12.500000
安装
slict位于Python包索引(PyPI)
pip install slict
项目详情
关闭
slict-0.2.5.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | d9394a19bc8de36fbefd23f24fdd7358dd183101be92fb8de45f2bb46e5b4ac1 |
|
MD5 | d59d9e1af343eb44e8eb164488931bb2 |
|
BLAKE2b-256 | 307f9af907f2caf7af1c3b5cf17932c90a9bf4b7bc1c508ae9313eb4cf18b0fa |