Random from Dictionary

Tim Payne tpayne at mac.com
Thu Oct 18 15:37:20 CEST 2001

In article <9qml3o$ovl8k$1 at ID-11957.news.dfncis.de>, Emile van Sebille
<emile at fenx.com> wrote:

> Maybe choice in random helps out.

I've always gotten this error when trying choice. I figured you just
couldn't use it on a dictionary, but maybe something else is wrong with
my install?

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.1/random.py", line 329, in choice
    return seq[int(self.random() * len(seq))]
KeyError: 1

More information about the Python-list mailing list