Python字典中的匹配键

Ric*_*ckD 0 python dictionary

我有以下内容适用于匹配字典中的键.

if mydict.__contains__('bananas'):
    print "found"
Run Code Online (Sandbox Code Playgroud)

有没有一种办法立足if的逻辑,该字符串找到

小智 8

这个有可能:

if "bananas" not in mydict:
    print "not found"
Run Code Online (Sandbox Code Playgroud)