select random entry from dictionary

chengdu at gmail.com chengdu at gmail.com
Tue Mar 8 02:44:34 CET 2005


import random

print  d[d.keys()[int(random.random()*len(d.keys()))]]

HTH

-c




More information about the Python-list mailing list