What is a convenient way of making a copy of a dictionary and only keep entries that are relevant to you?
Here I try to create a dictionary newdict:
mydict = {'A':'dog',
           'B':'cat',
           'C':'mouse'}
list_of_keys = ['A', 'B']
newdict = mydict[list_of_keys]
This syntax does not work. How would I create newdict which looks like this:
newdict{'A':'dog', 'B':'cat'}