how can i randomly choose keys in dictionary

neutrinman at myrealbox.com neutrinman at myrealbox.com
Thu Feb 17 21:13:46 EST 2005


Hi,there. How can I choose a key in dictionary randomly?

Say, random.choice() in lists,

or in lists:
lists = [1,2,3,4]
position = random.range(len(lists))
word = lists[position]




More information about the Python-list mailing list