create words of various lengths

Fredrik Lundh fredrik at pythonware.com
Fri May 13 13:56:59 EDT 2005


superprad at gmail.com wrote:

> no specific number of words.

anything between one and a gazillion, you mean?  having some idea of
the upper bound helps when chosing what algorithm/database/computer
to use...

> and I get a syntax error on line:
> > words["".join(choice(alphabet) for i in range(randint(1,15)))] = None

so what's your excuse for not using a recent version of Python? ;-)

if you're stuck with an older version,

    words["".join([choice(alphabet) for i in range(randint(1,15))])] = None

should work.

</F>






More information about the Python-list mailing list