Created
November 9, 2015 03:26
-
-
Save spectras/0f50994c7086fb139567 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/33601864 | |
products = { | |
'Cat1': { | |
'Prod1': { | |
'comment': 'ABC', | |
'indicator': 'Flat', | |
'pricelow': '10', | |
'priceaverage': '20', | |
'pricehigh': '30'}, | |
'Prod2:': { | |
'comment': 'ABC', | |
'indicator': 'Flat', | |
'pricelow': '20', | |
'priceaverage': '30', | |
'pricehigh': '40'}, | |
'Prod3': { | |
'comment': 'ABC', | |
'indicator': 'Flat', | |
'pricelow': '50', | |
'priceaverage': '60', | |
'pricehigh': '70'}}, | |
'Cat2': { | |
'Prod4': { | |
'comment': 'ABC', | |
'indicator': 'Flat', | |
'pricelow': '10', | |
'priceaverage': '20', | |
'pricehigh': '30'}} | |
} | |
productlist = [] | |
for item in products: | |
for subitem in products[item]: | |
products[item][subitem]['name'] = subitem | |
productlist.append(products[item][subitem]) | |
from pprint import pprint | |
pprint(productlist) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment