<div class="gmail_quote">On Mon, Dec 28, 2009 at 1:41 PM, MRAB <span dir="ltr"><<a href="mailto:python@mrabarnett.plus.com">python@mrabarnett.plus.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Victor Subervi wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi;<br>
I'm using python 2.4.3 which apparently requires that I import Set:<br>
from sets import Set<br>
I've done this. In another script I successfully manipulated MySQL sets by so doing. Here's the code snippet from the script where I was able to call the elements in a for loop:<br>
<br>
if isinstance(colValue[0], (str, int, float, long, complex, unicode, list, buffer, xrange, tuple)):<br>
pass<br>
else:<br>
try:<br>
html = "<b>%s</b>: <select name='%s'>" % (col, col)<br>
notSet = 0<br>
for itm in colValue[0]:<br>
try:<br>
color, number = itm.split(':')<br>
html += "<option name='%s'>%s</option>" % (itm, color)<br>
except:<br>
</blockquote>
<br></div>
DON'T USE BARE EXCEPTS!<br>
<br>
(There are 2 in your code.)</blockquote><div><br>There are times when they are *necessary*. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
html += "<option name='%s'>%s</option>" % (itm, itm)<br>
However, when I try that in my current script, the script fails. It throws no error, but rather just quits printing to the screen. Here's the code snippet:<br>
<br>
elif types[x][0:3] == 'set':<br>
for f in field:<br>
print '<td>%s</td>\n' % (field)<br>
else:<br>
print '<td>%s</td>\n' % (field)<br>
<br>
</blockquote></div>
[snip]<br>
<br>
You're printing the entire field for each value in the field. Is this<br>
intentional?<br></blockquote><div><br>It doesn't matter. The code ceases to execute with the line:<br><br>for f in field:<br>beno<br></div></div>