Itertools question: how to call a function n times?
matt at tplus1.com
Thu Jul 19 17:35:44 CEST 2007
I want to write a function that each time it gets called, it returns a
random choice of 1 to 5 words from a list of words.
I can write this easily using for loops and random.choice(wordlist) and
But I want to know how to do this using itertools, since I don't like
manually doing stuff like:
phrase = list()
for i in random.randint(1, 5):
It just seems slow.
All advice welcome.
A better way of running series of SAS programs:
More information about the Python-list