跳转到主要内容

可切片字典

项目描述

Build Status Version Status Downloads

支持切片的字典。

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 (3.0 kB 查看哈希值

上传时间: 源代码

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面