select random entry from dictionary

chengdu at gmail.com chengdu at gmail.com
Mon Mar 7 20:44:34 EST 2005


import random

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

HTH

-c




More information about the Python-list mailing list