跳转到主要内容

Python的Bencodex读取器/写入器

项目描述

Build Status

此包实现了Bencodex序列化格式,该格式扩展了Bencoding

用法

此包的API遵循Python的picklejson模块的传统

  • bencodex.dump(obj: bencodex.BValue, fileobj: typing.BinaryIO) -> None

  • bencodex.dumps(obj: bencodex.BValue) -> bytes

  • bencodex.load(fileobj: typing.BinaryIO) -> bencodex.BValue

  • bencodex.loads(encoded: bytes) -> bencodex.BValue

示例

>>> from bencodex import dumps, loads
>>> dumps({'name': 'Jane Doe', 'age': 30, 'nationality': ['BR', 'US']})
b'du3:agei30eu4:nameu8:Jane Doeu11:nationalitylu2:BRu2:USee'
>>> loads(_)
{'age': 30, 'name': 'Jane Doe', 'nationality': ['BR', 'US']}

许可证

GPLv3或更高版本下分发。

项目详情


下载文件

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

源分布

bencodex-1.0.1.tar.gz (8.7 kB 查看散列)

上传时间:

构建分布

bencodex-1.0.1-py3-none-any.whl (16.1 kB 查看哈希值)

上传时间 Python 3

由以下支持