skuid对应普通发货价

# coding: utf-8
import requests
import time
import jsonvalue_list=[{"propertyId": 4665,"name": "尺码","value": "35.5","propertyValueId": 20194173,"level": 1,"customValue": "","showValue": 1,"sort": 0,"definitionId": 6
}, {"propertyId": 4665,"name": "尺码","value": "36","propertyValueId": 20194174,"level": 1,"customValue": "","showValue": 1,"sort": 1,"definitionId": 6
}, {"propertyId": 4665,"name": "尺码","value": "36.5","propertyValueId": 20194175,"level": 1,"customValue": "","showValue": 1,"sort": 2,"definitionId": 6
}, {"propertyId": 4665,"name": "尺码","value": "37.5","propertyValueId": 20194176,"level": 1,"customValue": "","showValue": 1,"sort": 3,"definitionId": 6
}, {"propertyId": 4665,"name": "尺码","value": "38","propertyValueId": 20194177,"level": 1,"customValue": "","showValue": 1,"sort": 4,"definitionId": 6
}, {"propertyId": 4665,"name": "尺码","value": "48.5","propertyValueId": 20194191,"level": 1,"customValue": "","showValue": 1,"sort": 22,"definitionId": 6
}]skus_list=[{"skuId": 600070406,"spuId": 1011006,"authPrice": 0,"status": 1,"properties": [{"level": 1,"propertyValueId": 20194173}]
}, {"skuId": 600070407,"spuId": 1011006,"authPrice": 0,"status": 1,"properties": [{"level": 1,"propertyValueId": 20194174}]
}, {"skuId": 600070408,"spuId": 1011006,"authPrice": 0,"status": 1,"properties": [{"level": 1,"propertyValueId": 20194175}]
}, {"skuId": 600070409,"spuId": 1011006,"authPrice": 0,"status": 1,"properties": [{"level": 1,"propertyValueId": 20194176}]
}, {"skuId": 600070410,"spuId": 1011006,"authPrice": 0,"status": 1,"properties": [{"level": 1,"propertyValueId": 20194177}]
}, {"skuId": 600070424,"spuId": 1011006,"authPrice": 0,"status": 1,"properties": [{"level": 1,"propertyValueId": 20194191}]
}]info_List={"code": 200,"msg": "success","data": {"skuInfoList": [{"skuId": 600070406,"faqType": -1}, {"skuId": 600070407,"minPrice": 416900,"tradeType": 2,"tradeChannelInfoList": [{"tradeType": 2,"bidType": 5,"tradeTypeName": "闪电直发","tradeDesc": "闪电直发","arrivalTimeText": "约2天到","tradeTypeText": "约2天到货","price": 416900,"saleInventoryNo": "SN1068613848"}, {"tradeType": 0,"bidType": 0,"tradeTypeName": "立即购买","tradeDesc": "普通发货","arrivalTimeText": "约5天到","price": 444900,"saleInventoryNo": "SN1068559548"}],"faqType": 2}, {"skuId": 600070408,"minPrice": 416900,"tradeType": 2,"tradeChannelInfoList": [{"tradeType": 2,"bidType": 5,"tradeTypeName": "闪电直发","tradeDesc": "闪电直发","arrivalTimeText": "约2天到","tradeTypeText": "约2天到货","price": 416900,"saleInventoryNo": "SN1068098024"}, {"tradeType": 0,"bidType": 0,"tradeTypeName": "立即购买","tradeDesc": "普通发货","arrivalTimeText": "约5天到","price": 432900,"saleInventoryNo": "SN1067938299"}],"faqType": 2}, {"skuId": 600070409,"minPrice": 385900,"tradeType": 0,"tradeChannelInfoList": [{"tradeType": 2,"bidType": 5,"tradeTypeName": "闪电直发","tradeDesc": "闪电直发","arrivalTimeText": "约2天到","tradeTypeText": "约2天到货","price": 408900,"saleInventoryNo": "SN1068092623"}, {"tradeType": 0,"bidType": 0,"tradeTypeName": "立即购买","tradeDesc": "普通发货","arrivalTimeText": "约5天到","price": 385900,"saleInventoryNo": "SN1068627769"}],"faqType": 2}, {"skuId": 600070410,"minPrice": 350900,"tradeType": 2,"tradeChannelInfoList": [{"tradeType": 2,"bidType": 5,"tradeTypeName": "闪电直发","tradeDesc": "闪电直发","arrivalTimeText": "约2天到","tradeTypeText": "约2天到货","price": 350900,"saleInventoryNo": "SN1068377364"}, {"tradeType": 0,"bidType": 0,"tradeTypeName": "立即购买","tradeDesc": "普通发货","arrivalTimeText": "约5天到","price": 356900,"saleInventoryNo": "SN1068148854"}, {"tradeType": 95,"tradeTypeName": "全新微瑕","price": 300600,"linkUrl": "https://m.poizon.com/mini/open?miniId=mini_95fen&options=%7B%22pt%22%3A%222%22%2C%22params%22%3A%7B%22goods_id%22%3A%22El0WZEdOR%22%2C%22title%22%3A%22Nike%20Dunk%20SB%20Laser%20Orange%20%5Cu767d%5Cu9ec4%5C%2F%5Cu7d2b%5Cu52feLow%22%7D%2C%22source%22%3A%22duAppSupplier%22%7D"}],"faqType": 2}, {"skuId": 600070411,"minPrice": 333900,"tradeType": 0,"tradeChannelInfoList": [{"tradeType": 2,"bidType": 5,"tradeTypeName": "闪电直发","tradeDesc": "闪电直发","arrivalTimeText": "约2天到","tradeTypeText": "约2天到货","price": 372900,"saleInventoryNo": "SN1068642488"}, {"tradeType": 0,"bidType": 0,"tradeTypeName": "立即购买","tradeDesc": "普通发货","arrivalTimeText": "约5天到","price": 333900,"saleInventoryNo": "SN1068276628"}],"faqType": 2}, {"skuId": 600070424,"minPrice": 398900,"tradeType": 0,"tradeChannelInfoList": [{"tradeType": 0,"bidType": 0,"tradeTypeName": "立即购买","tradeDesc": "普通发货","arrivalTimeText": "约5天到","price": 498900,"saleInventoryNo": "SN1068107239"}],"faqType": -1}],"faqInfoList": [{"faqType": 2,"exchangeDesc": "闪电直发","exchangeUrl": "https://m.poizon.com/hybird/h5other/plus-sellerFlow"}, {"faqType": 1,"exchangeDesc": "极速发货","exchangeUrl": "https://m.poizon.com/website/trade?extend=fast_logistics"}],"shipMode": {"exchangeDesc": "交易模式","exchangeUrl": "https://m.poizon.com/nezha/detail/5ef053d32795fafc8d4a78f0"},"totalMinPrice": 308900,"serverTime": 1601281396060,"canShowArrivalBtn": True,"timeThreshold": 100},"status": 200
}"""{
'skuId':600070413,
'value':'40',
'generalPrice':315900
}"""

JSON字符串两两对应

def parsing_skuinfoList(value_list, skus_list, info_List):value_map_propertyValueId = dict()for _value in value_list:if _value["propertyValueId"]:value_map_propertyValueId[str(_value["propertyValueId"])] = _value["value"]print("value_1111",value_map_propertyValueId)sku_map_values = dict()for _skus in skus_list:# print(_skus)skuId = _skus["skuId"]status = _skus["status"]properties = _skus["properties"]if properties:propertyValueId = properties[0]["propertyValueId"]if str(propertyValueId) in value_map_propertyValueId:sku_map_values[str(skuId)] = value_map_propertyValueId[str(propertyValueId)]real_skus_list = list()if info_List and isinstance(info_List, dict):skuInfoList = info_List.get("data", dict()).get("skuInfoList")if skuInfoList:for __skuInfo in skuInfoList:skuId = __skuInfo.get("skuId")tradeChannelInfoList = __skuInfo.get("tradeChannelInfoList")print(tradeChannelInfoList)if not tradeChannelInfoList or not skuId:continueprice = Nonefor trade_cl in tradeChannelInfoList:if trade_cl.get("tradeTypeName", "") == "立即购买":price = trade_cl.get("price") # SN1068550758saleInventoryNo = trade_cl.get("saleInventoryNo") # SN1068550758breakif price and skuId and str(skuId) in sku_map_values.keys():real_skus_list.append({'skuId': skuId,'value': sku_map_values[str(skuId)],'generalPrice': price})print(real_skus_list)return real_skus_listprint(" error ")if __name__ == '__main__':parsing_skuinfoList(value_list, skus_list, info_List)

运行结果:

[{'skuId': 600070407, 'value': '36', 'generalPrice': 444900}, {'skuId': 600070408, 'value': '36.5', 'generalPrice': 432900}, {'skuId': 600070409, 'value': '37.5', 'generalPrice': 385900}, {'skuId': 600070410, 'value': '38', 'generalPrice': 356900}, {'skuId': 600070424, 'value': '48.5', 'generalPrice': 498900}]

列表套字典三者匹配对应关系相关推荐

  1. python列表去重_python 字典列表/列表套字典 去重重复的字典数据

    python 字典列表/列表套字典 数据去重 第一种:def deleteDuplicate(li): func = lambda x, y: x if y in x else x + [y] li  ...

  2. html购物车总价,最完美的购物车页面js,可全选,计算总价,传列表套字典。

    购物车功能 产品一 单价10 数量1 产品二 单价20 数量2 产品三 单价30 数量3 产品四 单价40 数量4 合计:¥0 全选 结算 // 全选/反选 功能 $('#allcheck').cli ...

  3. Python读取excel文件可读取xlsx格式和xls格式可直接读取超链接,读出为字典格式(列表套字典),处理合并单元格的问题

    直接上代码:(代码有注释,代码下方有解释) 1.可读取excel中的xlsx格式文件 2.可读取excel中的xls格式文件 3.可直接读取网页上的excel的超链接 4.解决有列合并的情况以及行合并 ...

  4. python列表嵌套字典取值_我的 python 学习历程-Day05 字典/字典的嵌套

    一.字典的初识 为什么要有字典 字典与列表同属容器型数据类型,同样可以存储大量的数据,但是,列表的数据关联性不强,并且查询速度比较慢,只能按照顺序存储. 什么是字典 先说一下什么叫可变与不可变的数据类 ...

  5. python列表添加元素的三种方法定义集合数据对象_(1) List,tuple,dictionary,Python语法基础集,一,之,列表,元组,字典,集合...

    Python序列(列表.元组.字典.集合) 一.列表(List)与列表推导式 (一)列表(list) 1.列表是Python内置 可变序列 (列表中元素可增加删除或修改): 2.列表元素放在一对中括号 ...

  6. Python 字符串/列表/元组/字典之间的相互转换 - Python零基础入门教程

    目录 一.字符串 str 与列表 list 1.字符串转列表 2.列表转字符串 二.字符串 str 与字典 dict 1.字符串转字典 2.字典转字符串 三.列表 list 与字典 dict 1.列表 ...

  7. python处理列表中字典_Python 列表、元组、字典及集合操作详解

    一.列表 列表是Python中最基本的数据结构,是最常用的Python数据类型,列表的数据项不需要具有相同的类型 列表是一种有序的集合,可以随时添加和删除其中的元素 列表的索引从0开始 1.创建列表 ...

  8. python-元组,列表,字典常用方法

    字符串.列表.字典.元组.集合都是序列结构sequence,有下标.具备切片功能.可以存放任何类型数据. 列表list 定义: list = []        list=[1,2,'a'," ...

  9. Python序列 数据类型 创建方式 Tuple元组 Str字符串 List列表 dict字典 Set集合 range,zip,map,enumerate

    Python 序列分类 数据类型 详细介绍 Python 主要数据类型: 元组Tuple, 字符串Str,列表List,字典Dict,集合Set 对比 元组Tuple 字符串Str 列表List 字典 ...

  10. python列表元组字典集合实验心得_python学习小总结(列表、元组、字典、集合、字符串)...

    ---恢复内容开始--- 一.列表(list) 1.添加 append():追加,在列表末尾添加元素. 列表名.append(添加的元素) extend():扩展,在列表末尾添加元素. 列表名.ext ...

最新文章

  1. 【Linux 内核】进程管理 task_struct 结构体 ④ ( comm 字段 | 进程优先级字段 | cpus_ptr 字段 | mm、active_mm 字段 | fs 字段 )
  2. 用HTTP协议连接网络(HttpURLConnection)
  3. HBuilder X格式化美化代码快捷键
  4. POJ1088 滑雪题解+HDU 1078(记忆化搜索DP)
  5. java~springcloud微服务目录索引
  6. git 21天打卡day10-创建昵称分支并切换
  7. Matlab函数之lower函数与upper函数
  8. SecureCRT鼠标双击或拖成变成Ctrl+C的解决办法
  9. 简述Handler机制原理
  10. 纽约州立石溪分校计算机科学排名,美国纽约州立大学石溪分校排名~值得一看~...
  11. 程序开发团队---团队精神篇
  12. 搭建帮助中心无方法,Baklib帮你轻松解决
  13. 简单的手电筒程序(基于Camera类实现)
  14. JS 将对象拆开拼接成 URL
  15. RT9193稳压芯片的电路原理图
  16. CogColorExtractorTool工具功能
  17. 公司人才中介平台的设计与实现
  18. Vue中this.$confirm确定和取消执行不同的逻辑
  19. python大神代码_求python大神写一个windows可运行的代码,学习学习。
  20. GitHub狗屁不通文章生成器

热门文章

  1. Android基础之批量发送短信
  2. This account is currently not available 解决办法
  3. irr java_Java版的IRR(内部收益率)实现
  4. ubuntu18.04在状态栏显示网速
  5. Excel2013制作甘特图
  6. PHP excel导出 表格 ,带图片
  7. 君正X1000开发板/方案开发介绍
  8. 第十六周助教心得体会
  9. 数据分析师面试题目_数据分析师面试题目
  10. 经典vim插件功能说明、安装方法和使用方法介绍