模块(jsonpath、加密)

1.jsonpath模块

import jsonpath

wsc = {
    "money":19000,
    "house":{
        "beijing":["三环","四环","五环"],
        "shanghai":["静安区","浦东新区"]
    },
    "car":["bmw",benz,audi,byd],
    "pets":[
        {"name":"xiaohei","type":"dog"},
        {"name":"xiaobai","type":"cat"},
        {"name":"xiaofen","type":"cat"},
        {"name":"xiaolan","type":"dog"},
    ]
}

#$.pets[0].type
#result  = wsc["pets"][0]["type"] #原有的方法获取
#result  = jsonpath.jsonpath(wsc,"$.pets[0].type")
#result  = jsonpath.jsonpath(wsc,"$..car")
result  = jsonpath.jsonpath(wsc,"$..beijing")
print(result)

 

模块(jsonpath、加密)

上一篇:* nodejs应用健康检查&&平滑关闭服务


下一篇:数据库锁