2010/7/28 Dave Angel <da...@ieee.org> > > > ZUXOXUS wrote: > >> Oh, I think i got it: >> >> >> >>> for prod in itertools.product('ABC', 'ABC'): >>>>> >>>>> >>>> print(prod) >> >> ('A', 'A') >> ('A', 'B') >> ('A', 'C') >> ('B', 'A') >> ('B', 'B') >> ('B', 'C') >> ('C', 'A') >> ('C', 'B') >> ('C', 'C') >> >> Thank you very much!! >> >> 2010/7/28 ZUXOXUS <zuxo...@gmail.com> >> >> > You're top-posting, which loses all the context. In this forum, put your > comments after whatever lines you're quoting. > > Your latest version gets the product of two. But if you want an arbitrary > number, instead of repeating the iterable ('ABC' in your case), you can use > a repeat count. That's presumably what you were trying to do in your > earlier incantation. But you forgot the 'repeat' keyword: > > for prod in itertools.product('ABC', repeat=4): > xxxx > > will give you all the four-tuples. > > DaveA > > >
> Hey > Sorry for the top-posting, I forgot this rule Thanks for the reminder, Dave Angel, and for the 'repeat' keyword!
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor