Well, you could do this:
>>> if all (k in foo for k in ("foo","bar")):
... print "They're there!"
...
They're there!
More Related Contents:
- How to name a file using a value in a list in a dictionary?
- I am trying to modify a dictionary value using the exec function
- Python list of dictionaries search
- Replace values in a pandas series via dictionary efficiently
- Modifying a Python dict while iterating over it
- Why is dictionary ordering non-deterministic?
- Object of custom type as dictionary key
- Get the key corresponding to the minimum value within a dictionary
- Error: ” ‘dict’ object has no attribute ‘iteritems’ “
- How does the key argument in python’s sorted function work?
- Converting list of tuples into a dictionary
- How to print a dictionary’s key?
- What is the right way to treat Python argparse.Namespace() as a dictionary?
- How to print a dictionary line by line in Python?
- How to reverse a dictionary that has repeated values
- How to create a dictionary from a line of text?
- Convert list of strings to dictionary
- Elegant way to remove fields from nested dictionaries
- python: read json and loop dictionary
- Python: use mysqldb to import a MySQL table as a dictionary?
- Is there a difference between using a dict literal and a dict constructor?
- Is self.__dict__.update(**kwargs) good or poor style?
- Creating a dictionary with list of lists in Python
- dataframe to dict such that one column is the key and the other is the value [duplicate]
- Python Pickling Dictionary EOFError
- Python dictionary comprehension using locals() gives KeyError
- Fast way to copy dictionary in Python
- How to type hint a dictionary with values of different types
- How to convert string representation of dictionary in Pandas DataFrame to a new columns?
- How do I send list of dictionary as Body parameter together with Files in FastAPI?