Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下内容可以很好地匹配字典中的键。
if mydict.__contains__('bananas'): print "found"
有没有办法基于找不到if字符串的逻辑
if
这个有可能:
if "bananas" not in mydict: print "not found"