Ah! Thanks :)
V
On Fri, Oct 9, 2009 at 1:10 PM, Stephen Hansen apt.shan...@gmail.comwrote:
On Fri, Oct 9, 2009 at 11:04 AM, Victor Subervi
victorsube...@gmail.comwrote:
So, because the results in sstp were duplicates ( ['prescriptions',
'prescriptions'] ) it only returned one result in
Hi;
I have the following code:
elif table[0] == 't': # This is a store subtype table
bits = string.split(table, '0')
sst.append(bits[2])
sstp.append(bits[1])
subtypes = dict(zip(sstp, sst))
When I print these out to screen, I get this:
sst: ['doctors', 'patient']
sstp:
On Fri, Oct 9, 2009 at 10:02 AM, Victor Subervi victorsube...@gmail.comwrote:
Hi;
I have the following code:
elif table[0] == 't': # This is a store subtype table
bits = string.split(table, '0')
sst.append(bits[2])
sstp.append(bits[1])
subtypes = dict(zip(sstp,
On Fri, Oct 9, 2009 at 10:10 AM, Stephen Hansen apt.shan...@gmail.comwrote:
On Fri, Oct 9, 2009 at 10:02 AM, Victor Subervi
victorsube...@gmail.comwrote:
Hi;
I have the following code:
elif table[0] == 't': # This is a store subtype table
bits = string.split(table, '0')
You're right...how strange. Here's the whole code:
tables = []
bst = []
bdt = []
spt = []
sst = []
sstp = []
cursor.execute('show tables;')
all = cursor.fetchall()
for a in all:
tables.append(a[0])
for table in tables:
if table[0] == 'b': # This is a basic table
Changing the line:
subtypes = dict(zip(sstp, sst))
to:
subtypes = dict(zip(sst, sstp))
as I believe Stephen misread it to be causes the zip operation to return:
[('doctors', 'prescriptions'), ('patient', 'prescriptions')]
and thus the dict will contain:
{'patient': 'prescriptions',
So, because the results in sstp were duplicates ( ['prescriptions',
'prescriptions'] ) it only returned one result in the dict(zip()) statement.
Weird. Bug or feature? ;)
Thanks,
V
On Fri, Oct 9, 2009 at 12:37 PM, Stephen Hansen apt.shan...@gmail.comwrote:
Changing the line:
subtypes =
On Fri, Oct 9, 2009 at 11:04 AM, Victor Subervi victorsube...@gmail.comwrote:
So, because the results in sstp were duplicates ( ['prescriptions',
'prescriptions'] ) it only returned one result in the dict(zip()) statement.
Weird. Bug or feature? ;)
Thanks,
V
Feature.
zip() returned two