Re: iterating over DictRow

Поиск
Список
Период
Сортировка
От Karsten Hilbert
Тема Re: iterating over DictRow
Дата
Msg-id 20200924211147.GA2089@hermes.hilbert.loc
обсуждение исходный текст
Ответ на RE: iterating over DictRow  (David Raymond <David.Raymond@tomtom.com>)
Ответы Re: iterating over DictRow  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список psycopg
On Thu, Sep 24, 2020 at 02:53:40PM +0000, David Raymond wrote:

> Since DictRow's can be indexed by either the field name or
> the field index (either record["ID"] or record[0]) then I
> think what it "should" be is a little ambiguous.

I eventually thought so. I was, however, wondering whether I
should have _expected_ iteration over a DictRow to be a list
iteration.

Either of those

> for field in dict(the_dict):
> for field in the_dict.keys():

work, however (or RealDictCursor, for that matter).

Thanks all,
Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B



В списке psycopg по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: iterating over DictRow
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: iterating over DictRow