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())
キー、値のタプルを新しい辞書に含める必要があるかどうかを決定するために、辞書内包表記に条件式を含める方法に関する提案