跳转到主要内容

轻松遍历和查询字典

项目描述

https://badge.fury.io/py/t_dict.png https://travis-ci.org/vandersonmota/t_dict.png?branch=master https://pypip.in/d/t_dict/badge.png

轻松遍历和查询字典

  • 免费软件:BSD许可证

安装

pip install t_dict

为什么?

处理深度嵌套的字典可能非常痛苦。TDict旨在通过使用jsonpointer语法使其变得不那么无聊。

它依赖于jsonpointer(《https://pypi.python.org/pypi/jsonpointer》),该库实现了RFC - 《https://tools.ietf.org/html/rfc6901》

用法

from t_dict.t_dict import TDict

td = TDict({'nested': { 'dict': 'here', 'other': {'spam': 'eggs'} }})
td.find('/nested/dict')
>> 'here'
td.find('/nested/notfound', 'defaultvalue')
>> 'defaultvalue'

td.setin('/nested/dict', 'new')
td['nested']['dict'] == 'new'
>> True

# converts dict to TDict
isinstance(td.find('/nested/other'), TDict)
>> True

历史

0.1.0 (2014-01-11)

  • PyPI上的首次发布。

项目详情


下载文件

下载您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

t_dict-0.1.1.tar.gz (5.4 kB 查看散列)

上传时间: 源代码

支持