This would work:
random.choice([k for k in d for x in d[k]])
More Related Contents:
- How to select random key with common values?
- How to get a random value from dictionary?
- How can I get a random key-value pair from a dictionary?
- Using lambda function in python
- Create a dictionary with comprehension
- Make a dictionary with duplicate keys in Python
- Loop through all nested dictionary values?
- How do I create a list of random numbers without duplicates?
- Why do my Tkinter widgets get stored as None? [duplicate]
- How can you print a variable name in python? [duplicate]
- Multi-level defaultdict with variable depth?
- How can one continuously generate and track several random objects with a time delay in pygame? [duplicate]
- TypeError: ‘dict’ object is not callable
- List of tuples to dictionary [duplicate]
- python tuple to dict
- Appending a dictionary to a list in a loop
- One liner: creating a dictionary from list with indices as keys
- How can I create a random number that is cryptographically secure in python?
- Can PyYAML dump dict items in non-alphabetical order?
- Group by multiple keys and summarize/average values of a list of dictionaries
- Object-like attribute access for nested dictionary
- Changing marker style in scatter plot according to third variable
- How do I simulate flip of biased coin?
- How do I delete items from a dictionary while iterating over it?
- Counting each letter’s frequency in a string
- Checking a nested dictionary using a dot notation string “a.b.c.d.e”, automatically create missing levels
- How to create a Python dictionary with double quotes as default quote format?
- Getting random row through SQLAlchemy
- Working with floating point NumPy arrays for comparison and related operations
- Best way to choose a random file from a directory