How can you print a key given a value in a dictionary for Python?

I don't believe there is a way to do it. It's not how a dictionary is intended to be used... Instead, you'll have to do something similar to this.

for key, value in dictionary.items():
    if 4 == value:
        print key

In Python 3:

# A simple dictionary
x = {'X':"yes", 'Y':"no", 'Z':"ok"}

# To print a specific key (for instance the 2nd key which is at position 1)
print([key for key in x.keys()][1])

Output:

Y