a = {"hello" : "world", "cat":"bat"}
# Trying to achieve this
# Form a new dictionary only with keys with "hello" and their values
b = {"hello" : "world"}
# This didn't work
b = dict( (key, value) if key == "hello" for (key, value) in a.items())
关于如何在字典理解中包含条件表达式以确定键、值元组是否应包含在新字典中的任何建议