choosing a random element from a dictionary

Yuval yuvalfeld at
Thu Feb 6 01:30:27 CET 2003

Is there a function that picks a random element from a dictionary? To
my understanding the popitem() method does that, but it also removes
it from the dictionary. Of course I can use popitem() and add it back
directly, but is there any other way of doing so?


More information about the Python-list mailing list