Hello
I want to convert a Mysql resulset to a dictionary.
I made some code myself, and want to ask you if I do this the right way.
def remapmysql(a):
return (a[0], (a[1:]))
def test_map():
count = 10 # count of simulated records
l1 = range(0, count)
l2 = range(count , 2
Fredrik Lundh wrote:
> if you care about performance, and is using a recent Python, you could
yes i do ;-)
> try doing
>
>d1 = dict((row[0], row[1:]) for row in z1)
>
> instead, and see if that runs faster (this uses a generator expression
> instead of a callback and a full list).
>
>
>
Tim Chase wrote:
>> def remapmysql(a):
>> return (a[0], (a[1:]))
>>
>> def test_map():
>> count = 10 # count of simulated records
>> l1 = range(0, count)
>> l2 = range(count , 2 * count )
>> l3 = range(2 * count, 3 * count )
>> z1 = zip(l1, l2, l3) # simulate a mys
Dennis Lee Bieber wrote:
> It might be more economical to perform the conversion while fetching
> the data:
>
> mdict = {}
> for rec in crsr:
> mdict[rec[0]] = rec[1:]
>
I didn't think of that. I just took the fetchall() from my first
version (where I looped through the tuples, whi
Hello group!
I have an application which uses a lot of mysql data fields, all the
same data type (floats).
I created a panel which executes a "SELECT * FROM tablename" and makes
as much fields as needed, using de cursor.description as wx.statictext
and the cursors field contents copied into w
[EMAIL PROTECTED] wrote:
> On May 10, 10:51 pm, Pom <[EMAIL PROTECTED]> wrote:
>> Hello group!
>>
>> I have an application which uses a lot of mysql data fields, all the
>> same data type (floats).
>>
>> I created a panel which executes a "SELEC
Hello
I have a tuple of strings which I must show in a textctrl, each item in
the tuple representing one line of text.
The first three lines of text should each have another style (fontsize
and color)
i'm using this code to achieve this:
tmppos = self.txtInfo.GetInsertionPoint() # get the c
[EMAIL PROTECTED] wrote:
> On Mar 31, 3:13 am, Pom <[EMAIL PROTECTED]> wrote:
>> Hello
>>
>> I have a tuple of strings which I must show in a textctrl, each item in
>> the tuple representing one line of text.
>>
>> The first three lines of text should e
kind of serial ports being created when using USB and
bleutooth adapters, so i guess it's possible ???
Thanks in advance
Greets
Pom
--
http://mail.python.org/mailman/listinfo/python-list
sh)
Greetings!
Pom
--
http://mail.python.org/mailman/listinfo/python-list
10 matches
Mail list logo