更新时间:2023-01-31 14:31:43
好,您可以这样做:
>>> if all (k in foo for k in ("foo","bar")): ... print "They're there!" ... They're there!
如何在一次通过中检查多个键是否在 dict 中?
如何在一次通过中检查多个键是否在字典中?
如何检查字典中是否已存在一组键和值