So I have a dictionary called 'useraccounts'. I manage to obtain all of the keys of the items in the dictionary that are in class 12 by doing:
found = ([k for k in useraccounts if useraccounts[k]['class'] == '12']) The list returned is:
['bob', 'terry'] which is correct. Now is there anyway I could take these results as keys and then seperately use them to individually print relevant information from the dictionary. For example, get the program to print the results of:
useraccounts[THE_KEYS_FOUND_IN_THE_LIST]['totalscore'] Any help is greatly appreciated.
Thanks in advance.