0

I have a list with the keys:

mykeys=["a", "b"]
mydictionary = { "a": 1, "b": 3, "c": 6}

I want to print out the key, value pair from my keys. Example output:

result = {"a": 1, "b": 3 }

When I use list comprehension I can only get the values:

  [mydictionary[x] for x in mykeys]
JaneD
  • 53
  • 3

0 Answers0