Re: Zip Question

2009-10-10 Thread Victor Subervi
Ah! Thanks :) V On Fri, Oct 9, 2009 at 1:10 PM, Stephen Hansen wrote: > > > On Fri, Oct 9, 2009 at 11:04 AM, Victor Subervi > wrote: > >> So, because the results in sstp were duplicates ( ['prescriptions', >> 'prescriptions'] ) it only returned one result in the dict(zip()) statement. >> Weird.

Re: Zip Question

2009-10-09 Thread Stephen Hansen
On Fri, Oct 9, 2009 at 11:04 AM, Victor Subervi wrote: > 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 results, but dictiona

Re: Zip Question

2009-10-09 Thread Victor Subervi
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 wrote: > > > Changing the line: >> subtypes = dict(zip(sstp, sst))

Re: Zip Question

2009-10-09 Thread Stephen Hansen
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', '

Re: Zip Question

2009-10-09 Thread Victor Subervi
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 i

Re: Zip Question

2009-10-09 Thread Chris Kaynor
On Fri, Oct 9, 2009 at 10:10 AM, Stephen Hansen wrote: > > > On Fri, Oct 9, 2009 at 10:02 AM, Victor Subervi > wrote: > >> 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]) >>

Re: Zip Question

2009-10-09 Thread Stephen Hansen
On Fri, Oct 9, 2009 at 10:02 AM, Victor Subervi wrote: > 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 pr

Zip Question

2009-10-09 Thread Victor Subervi
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: ['