This would work:
random.choice([k for k in d for x in d[k]])
Related Contents:
- How to get a random value from dictionary?
- How can I get a random key-value pair from a dictionary?
- Are dictionaries ordered in Python 3.6+?
- Why is the order in dictionaries and sets arbitrary?
- Remap values in pandas column with a dict, preserve NaNs
- How to copy a dictionary and only edit the copy
- How are Python’s Built In Dictionaries Implemented?
- Is there any pythonic way to combine two dicts (adding values for keys that appear in both)?
- Django template how to look up a dictionary value with a variable
- Determine the type of an object?
- How to merge dictionaries of dictionaries?
- How can I use pickle to save a dict (or any other Python object)?
- How do I create a list of random numbers without duplicates?
- Generate random integers between 0 and 9
- How to filter a dictionary according to an arbitrary condition function?
- Convert Django Model object to dict with all of the fields intact
- Generate random numbers summing to a predefined value
- How to properly subclass dict and override __getitem__ & __setitem__
- Create a list with initial capacity in Python
- Multi-level defaultdict with variable depth?
- Object of custom type as dictionary key
- Inverting a dictionary with list values
- How to add multiple values to a dictionary key in python?
- What is the most pythonic way to pop a random element from a list?
- Order of keys in dictionary
- Creating a dictionary from a CSV file
- How can one continuously generate and track several random objects with a time delay in pygame? [duplicate]
- Differences between numpy.random and random.random in Python
- python filter list of dictionaries based on key value
- How do I print the key-value pairs of a dictionary in python
- Is there a recursive version of the dict.get() built-in?
- join two lists of dictionaries on a single key
- Random state (Pseudo-random number) in Scikit learn
- Sorting a dictionary by value then key
- How do you find the first key in a dictionary?
- Sampling uniformly distributed random points inside a spherical volume
- How to merge dicts, collecting values from matching keys?
- Check if value already exists within list of dictionaries?
- What is the purpose of collections.ChainMap?
- Search for a key in a nested Python dictionary
- TypeError: ‘dict_keys’ object does not support indexing
- How to hash a string into 8 digits?
- can you write a str.replace() using dictionary values in Python?
- Binary random array with a specific proportion of ones?
- Is there a ‘multimap’ implementation in Python?
- Python – Printing a dictionary as a horizontal table with headers
- How do I create a unique value for each key using dict.fromkeys? [duplicate]
- Choosing a function randomly
- How can I get dictionary key as variable directly in Python (not by searching from value)?
- How to generate a random normal distribution of integers