<div>So you want to convert a list into a tuple.&nbsp; </div>
<div>&nbsp;</div>
<div>Here ya go, using your example of the table setup:</div>
<div>&nbsp;</div>
<div>&gt;&gt;&gt; raw_table =&quot;&quot;&quot;<br>%s | %s | %s<br>--------------<br>%s | %s | %s<br>--------------<br>%s | %s | %s<br>&quot;&quot;&quot;</div>
<div>&gt;&gt;&gt; from random import choice<br>&gt;&gt;&gt; x_o = [choice(['x','o']) for i in range(9)]<br>&gt;&gt;&gt; x_o<br>['x', 'x', 'x', 'x', 'o', 'o', 'o', 'x', 'x']<br>&gt;&gt;&gt; filled_table = raw_table % tuple(x_o)
<br>&gt;&gt;&gt; print filled_table</div>
<div>
<p>x | x | x<br>--------------<br>x | o | o<br>--------------<br>o | x | x</p>
<p>&gt;&gt;&gt; </p></div>
<div><span class="gmail_quote">On 11/24/06, <b class="gmail_sendername">Mihai Iacob</b> &lt;<a href="mailto:aymchaos@yahoo.com">aymchaos@yahoo.com</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hello,<br><br>This is my first post so if i make any kind of<br>mistakes take it easy on me :).<br><br>I don't know how to explain clearly what is the
<br>problem but i'll try.<br>table = &quot;&quot;&quot;<br>%s |%s |%s<br>-----------<br>%s |%s |%s<br>-----------<br>%s |%s |%s<br>&quot;&quot;&quot;<br><br>listTable is a dictionary.<br><br>listTable = {0 :'X', 1 :' ' , 2 :' ', 3 :'O', 4 :' ',
<br>5 :' ', 6 :'O', 7 :' ', 8 :'X',}<br><br>I am trying to take the values from the dictionary<br>listTable.values() and print them in the table.<br><br>The problem is that listTable.values() returns a list<br>&nbsp;&nbsp;&quot; ['X', ' ', ' ', 'O', ' ', ' ', 'O', ' ', 'X']&nbsp;&nbsp;&quot;
<br>and python won't assign the values of the dictionary<br>in the table. &quot; table %&nbsp;&nbsp;listTable.values() &quot;<br><br>This error message appears:<br><br>Traceback (most recent call last):<br>File &quot;&lt;pyshell#81&gt;&quot;, line 1, in &lt;module&gt;
<br>&nbsp;&nbsp; table % listTable.values()<br>TypeError: not enough arguments for format string<br><br><br>So instead of the list&nbsp;&nbsp;&quot; ['X', ' ', ' ', 'O', ' ', '<br>', 'O', ' ', 'X'] &quot; which won't let me assign strings<br>
in the table, i want to get ('X', ' ', ' ', 'O', ' ',<br>' ', 'O', ' ', 'X') from listTable.values()<br><br>I know i can make it work using:<br>table % (listTable[0],listTable[1],<br>listTable[2],listTable[3],listTable[4],
<br>listTable[5],listTable[6],listTable[7],listTable[8])<br><br>but it's kinda long.<br><br><br>If somebody can tell me how to convert the []list into<br>() i'll make him a little shrine and worship him for 5<br>seconds :P
<br><br>I'm trying to make a OXO game, so don't give me any<br>hints even if you spot mistakes (i hope i can make it<br>alone)<br><br><br><br><br><br>____________________________________________________________________________________
<br>Do you Yahoo!?<br>Everyone is raving about the all-new Yahoo! Mail beta.<br><a href="http://new.mail.yahoo.com">http://new.mail.yahoo.com</a><br>_______________________________________________<br>Tutor maillist&nbsp;&nbsp;-&nbsp;&nbsp;<a href="mailto:Tutor@python.org">
Tutor@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a><br></blockquote></div><br>