> Hi,there. How can I choose a key in dictionary randomly? > > Say, random.choice() in lists,
A dictionary's keys() are a list, so you already have the answer: >>> import random >>> d = {'a': 1, 'b': 2, 'c': 3} >>> random.choice(d.keys()) =Tony.Meyer -- http://mail.python.org/mailman/listinfo/python-list