(Python) Converting a dictionary to a list?

Posted by Daria Egelhoff on Stack Overflow See other posts from Stack Overflow or by Daria Egelhoff
Published on 2012-04-10T05:19:39Z Indexed on 2012/04/10 5:29 UTC
Read the original article Hit count: 233

Filed under:

So I have this dictionary:

ScoreDict = {"Blue": {'R1': 89, 'R2': 80},
            "Brown": {'R1': 61, 'R2': 77},
            "Purple": {'R1': 60, 'R2': 98},
            "Green": {'R1': 74, 'R2': 91},
            "Red": {'R1': 87, 'Lon': 74}}

Is there any way how I can convert this dictionary into a list like this:

ScoreList = [['Blue', 89, 80], ['Brown', 61, 77], 
['Purple', 60, 98], ['Green', 74, 91], ['Red', 87, 74]]

I'm not too familiar with dictionaries, so I really need some help here. Thanks in advance!

© Stack Overflow or respective owner

Related posts about python