【文件属性】:
文件名称:nested_encode:将嵌套结构(例如 json.loads)中的 unicode 对象转换为 utf-8 编码字节
文件大小:8KB
文件格式:ZIP
更新时间:2021-06-08 11:19:50
Python
嵌套编码
将嵌套结构(例如 json.loads)中的 unicode 对象转换为 utf-8 编码字节。 例如:
# Before
{ u'a' : [{ 'b' : [( 1 , 2 , [ u' \xd6 sterreich' ])]}]}
# After
{ 'a' : [{ 'b' : [( 1 , 2 , [ ' \xc3 \x96 sterreich' ])]}]}
注意:复制字典,就地更改列表和元组。
性能开销:大约 10%。
用法
import simplejson
from nested_encode import encode_nested
def loads ( data ):
return encode_nested ( simplejson . loads ( data ))
安装
pip install git+https://github.
【文件预览】:
nested_encode-master
----setup.py(745B)
----.gitignore(8B)
----nested_encode()
--------__init__.py(42B)
--------_convert_nested.c(3KB)
--------tests()
----LICENSE.md(1KB)
----README.md(588B)