模块(jsonpath、加密)

时间:2021-01-24 18:26:39   收藏:0   阅读:40

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)

 

原文:https://www.cnblogs.com/huahuacheng/p/14320980.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!