Nested dictionaries from a list ?

Wacky waqar.hafiz at gmail.com
Sun Dec 7 11:18:03 EST 2014


New to Python, so please go easy.
I've a list of users, who have different profiles on different computers. How to tackle this through lists and dictionaries? Here is the data example. More interested in learning how to declare this structure and add/delete/extract values from whatever data structure is proposed.

users = [ 'Tom', 'Dick', 'Harry' ]

{ 'Tom': { 'computerA: 'Profile101'
           'computerB: 'Profile102'
           'computerC: 'Profile103' }

{ 'Dick': { 'computerA: 'Profile389'
            'computerB: 'Profile390' }

{ 'Harry': { 'computerA: 'Profile201'
             'computerB: 'Profile202'
             'computerC: 'Profile203'
             'computerD: 'Profile204' }

Thanks in advance




More information about the Python-list mailing list