Re: dynamic if statement

2013-06-20 Thread upperdecksu
On Tuesday, June 18, 2013 10:10:42 AM UTC-4, upper...@gmail.com wrote: I am new to python and struggling with creating a dynamic if statement. I have a set of queries that are run against various databases/tables. The result is all the same in that I always get back the same field

dynamic if statement

2013-06-18 Thread upperdecksu
I am new to python and struggling with creating a dynamic if statement. I have a set of queries that are run against various databases/tables. The result is all the same in that I always get back the same field names. What I want to do is total the results differently based on the table. so

Re: dynamic if statement

2013-06-18 Thread Tim Chase
On 2013-06-18 07:10, upperdec...@gmail.com wrote: I have a set of queries that are run against various databases/tables. The result is all the same in that I always get back the same field names. I query fld1, fld2, fld3, qty, qty2 from table1 then I loop thru the results if fld1 = 'a'

Re: dynamic if statement

2013-06-18 Thread Mark Lawrence
On 18/06/2013 15:56, Tim Chase wrote: On 2013-06-18 07:10, upperdec...@gmail.com wrote: I have a set of queries that are run against various databases/tables. The result is all the same in that I always get back the same field names. I query fld1, fld2, fld3, qty, qty2 from table1 then I loop

Re: dynamic if statement

2013-06-18 Thread Tim Chase
On 2013-06-18 16:27, Mark Lawrence wrote: On 18/06/2013 15:56, Tim Chase wrote: name_index_map = dict( (info[0], i) for info, i in enumerate(cursor.description) Looks like this should be :- for i, info in enumerate(cursor.description) Doh, indeed, you're correct. As