ANSWERS: 1
  • Seems to me that you are looking for dictionaries: http://docs.python.org/tutorial/datastructures.html#dictionaries But if I understand you right, you have two lists that you want to convert to a dicionary. Then you have to loop the lists, like this: list1 = ['donald', 'mickey'] list2 = ['duck', 'mouse'] hello = {} for i in range(len(list1)): hello[list1[i]] = list2[i] print hello['donald']

Copyright 2023, Wired Ivy, LLC

Answerbag | Terms of Service | Privacy Policy