You're right...how strange. Here's the whole code:<br><br> tables = []<br> bst = []<br> bdt = []<br> spt = []<br> sst = []<br> sstp = []<br> cursor.execute('show tables;')<br> all = cursor.fetchall()<br>
for a in all:<br> tables.append(a[0])<br> for table in tables:<br> if table[0] == 'b': # This is a basic table<br> if table[1] == '0': # This is a basic static table<br> bst.append(table)<br>
# elif table[1] == '1': # This is a basic dynamic table<br># bdt.append(table)<br># Basic dynamic tables, like "pic" below, have to be manually created.<br> elif table[0] == 's': # This is a store table<br>
if table[1] == '0': # This is a store primary table<br> spt.append(table)<br> elif table[0] == 't': # This is a store subtype table<br> bits = string.split(table, '0')<br> sst.append(bits[2])<br>
sstp.append(bits[1])<br> subtypes = dict(zip(sstp, sst))<br> print sst<br> print '<br />'<br> print sstp<br> print '<br />'<br> print subtypes<br> print '<br />'<br><br>
This is what prints out:<br><br>['doctors', 'patient']
<br>
['prescriptions', 'prescriptions']
<br>
{'prescriptions': 'patient'}
<br>
<input name="bst" value="[" type="hidden">
<input name="sst" value="[" type="hidden">
<input name="sstp" value="[" type="hidden">
<br>TIA,<br>V<br><br><div class="gmail_quote">On Fri, Oct 9, 2009 at 12:10 PM, Stephen Hansen <span dir="ltr"><<a href="mailto:apt.shansen@gmail.com">apt.shansen@gmail.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;">
<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Fri, Oct 9, 2009 at 10:02 AM, Victor Subervi <span dir="ltr"><<a href="mailto:victorsubervi@gmail.com" target="_blank">victorsubervi@gmail.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;">
Hi;<br>I have the following code:<br><br> elif table[0] == 't': # This is a store subtype table<br> bits = string.split(table, '0')<br> sst.append(bits[2])<br> sstp.append(bits[1])<br> subtypes = dict(zip(sstp, sst))<br>
<br>When I print these out to screen, I get this:<br><br>sst: ['doctors', 'patient']
<br>
sstp: ['prescriptions', 'prescriptions']
<br>
subtypes: {'prescriptions': 'patient'}
<input name="bst" value="[" type="hidden">
<input name="sst" value="[" type="hidden">
<input name="sstp" value="[" type="hidden">
<br><br>Why do I only get one item from sst and sstp zipped? Why not both??</blockquote></div></div><div>I think you have a logic problem that's not shown in that code sample:</div><div><br></div><div><div class="im">
<div>>>> sst = ['doctors', 'patient']</div>
<div>>>> sstp = ['prescriptions', 'prescriptions']</div></div><div>>>> zip(sst,sstp)</div><div>[('doctors', 'prescriptions'), ('patient', 'prescriptions')]</div>
<div>>>> dict(zip(sst,sstp))</div><div>{'patient': 'prescriptions', 'doctors': 'prescriptions'}</div><div>>>> </div><div><br></div><font color="#888888"><div>--S</div></font></div>
</div>
</blockquote></div><br>