Select as dictionary...

Abandoned besturk at gmail.com
Mon Oct 1 13:09:08 EDT 2007


On 1 Ekim, 18:13, Bruno Desthuilliers <bruno.
42.desthuilli... at wtf.websiteburo.oops.com> wrote:
> J. Clifford Dyer a écrit :
>
> > On Mon, Oct 01, 2007 at 03:50:59PM +0200, Bruno Desthuilliers wrote regarding Re: Select as dictionary...:
> >> IIRC, postgres' db-api connector (well, at least one of them - I don't
> >> know which one you're using) has a DictCursor. You should find all you
> >> want to know in the relevant doc.
>
> > Correct me if I'm wrong, but I think the DictCursor would output the following:
>
> > [{'id': 1, 'value': 5}, {'id': 2, 'value': 5}, ...]
>
> > But the OP wanted one dict with IDs as keys:
>
> > {1: 5, 2: 5, ...}
>
> Hmmm... I did answer too fast, indeed. Thanks for pointing that out.

Very very very thanks to everybody.
I'm a new user in this group and you are wonderfull persons :)




More information about the Python-list mailing list