<br><br><div class="gmail_quote">2010/7/28 Dave Angel <span dir="ltr"><<a href="mailto:davea@ieee.org">davea@ieee.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
<br>
ZUXOXUS wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Oh, I think i got it:<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
for prod in itertools.product('ABC', 'ABC'):<br>
<br>
</blockquote></blockquote></blockquote>
print(prod)<br>
<br>
('A', 'A')<br>
('A', 'B')<br>
('A', 'C')<br>
('B', 'A')<br>
('B', 'B')<br>
('B', 'C')<br>
('C', 'A')<br>
('C', 'B')<br>
('C', 'C')<br>
<br>
Thank you very much!!<br>
<br>
2010/7/28 ZUXOXUS <<a href="mailto:zuxoxus@gmail.com" target="_blank">zuxoxus@gmail.com</a>><br>
<br>
</blockquote></div>
You're top-posting, which loses all the context. In this forum, put your comments after whatever lines you're quoting.<br>
<br>
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:<br>
<br>
for prod in itertools.product('ABC', repeat=4):<br>
xxxx<br>
<br>
will give you all the four-tuples.<br>
<br>
DaveA<br>
<br>
<br>
</blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hey<br></blockquote><div><br></div><div>Sorry for the top-posting, I forgot this rule </div>
</div><br><div>Thanks for the reminder, Dave Angel, and for the 'repeat' keyword!</div>