import json
import re
a = {
"code": 0,
"description": "",
"lastUpdateTime": 0,
"payload": {
"currentPage": 0,
"totalPages": 0,
"totalCount": 2,
"list": [
{
"id": 788380,
"tradeNo": "788380",
"realName": "yyyy",
"mobile": "11111111111",
"idCardNo": "3",
"orderStatus": 4,
"createDateTime": 1562249949000,
"updateDateTime": 1562249949000,
"opUserId": 0,
"opUserName": "",
"userId": 150045,
"userName": None,
"remark": "",
"distributorId": 1,
"distributorName": "Test",
"financeProductId": 1,
"financeProductName": "Test",
"financeProductType": 1,
"financeProductRentTime": 1,
"financeProductReturnCarFlag": 1,
"financeProductDownPayment": 3,
"financeProductMonthlyRental": 3,
"financeProductServiceCharge": 3,
"financeProductGuaranteeDeposit": 3,
"financeProductTailMoney": 3,
"financeProductTailInstalmentFlag": 1,
"vehicleId": 1,
"vehicleName": "3",
"vehicleSeries": "3",
"vehicleModel": "2019款 180TURBO CVT 舒适版",
"vehicleSaleId": 1,
"vehicleSalePrice": 1000,
"cityid": 110100,
"cityname": "北京市",
"colorName": None,
"color": "#0D2E0F",
"intentionalModel": "332019款 180TURBO CVT 舒适版"
},
{
"id": 661939,
"tradeNo": "661939",
"realName": "yyyy",
"mobile": "11111111111",
"idCardNo": "3",
"orderStatus": 4,
"createDateTime": 1562249944000,
"updateDateTime": 1562249944000,
"opUserId": 0,
"opUserName": "",
"userId": 150045,
"userName": None,
"remark": "",
"distributorId": 1,
"distributorName": "Test",
"financeProductId": 1,
"financeProductName": "Test",
"financeProductType": 1,
"financeProductRentTime": 1,
"financeProductReturnCarFlag": 1,
"financeProductDownPayment": 3,
"financeProductMonthlyRental": 3,
"financeProductServiceCharge": 3,
"financeProductGuaranteeDeposit": 3,
"financeProductTailMoney": 3,
"financeProductTailInstalmentFlag": 1,
"vehicleId": 1,
"vehicleName": "3",
"vehicleSeries": "3",
"vehicleModel": "2019款 180TURBO CVT 舒适版",
"vehicleSaleId": 1,
"vehicleSalePrice": 1000,
"cityid": 110100,
"cityname": "北京市",
"colorName": None,
"color": "#0D2E0F",
"intentionalModel": "332019款 180TURBO CVT 舒适版"
}
]
}
}
=============================
#是否存在的查询
result = a["payload"]["list"]
ret = []
for i in result:
ret.append(i["orderStatus"])
b=[2,5]
print(set(ret).issubset(set(b))) #判断ret是否在b这个列表里面,存在返回True,不存在返回False
# 大小比较的查询
result = a["payload"]["list"]
ret = []
for i in result:
ret.append(i["orderStatus"])
test=[status for status in ret if 6>=status >=5] #存在返回True,不存在返回False
if not test :
print("False")
else:
print("True")