Novice Question: two lists -> dictionary

jwtozer at my-dejanews.com jwtozer at my-dejanews.com
Wed Apr 14 22:31:27 EDT 1999


How do I make the members of one list the key of a dictionary and the members
of a second list the members of list values associated with with those keys?

Given:

ListA = ['10', '10', '20', '20', '20', '24']
ListB = ['23', '44', '11', '19', '57', '3']

Desired Result:

Dict = {'10': ['23','44'],'20': ['11','19','57'], '24': ['3']}

Any help will be much appreciated.


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




More information about the Python-list mailing list