Random from Dictionary
Mikael Olofsson
mikael at isy.liu.se
Thu Oct 18 10:11:32 EDT 2001
On 18-Oct-2001 Tim Payne wrote:
> 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
Couldn't you use it on yourdict.keys()?
/Mikael
-----------------------------------------------------------------------
E-Mail: Mikael Olofsson <mikael at isy.liu.se>
WWW: http://www.dtr.isy.liu.se/dtr/staff/mikael
Phone: +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date: 18-Oct-2001
Time: 16:10:37
/"\
\ / ASCII Ribbon Campaign
X Against HTML Mail
/ \
This message was sent by XF-Mail.
-----------------------------------------------------------------------
Linköpings kammarkör: www.kammarkoren.com
More information about the Python-list
mailing list