You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
489 B
12 lines
489 B
def get_goods_list(goods_resp, _format): |
|
goods_list = [] |
|
if _format == 'json': |
|
for goods_cate in goods_resp: |
|
goods_list = goods_list + goods_cate['goods'] |
|
if _format == 'xml': |
|
for goods_cate in goods_resp['cate']: |
|
if isinstance(goods_cate['goods']['item'], dict): |
|
goods_list.append(goods_cate['goods']['item']) |
|
else: |
|
goods_list = goods_list + goods_cate['goods']['item'] |
|
return goods_list
|
|
|