| От | Adrian Klaver |
|---|---|
| Тема | Re: iterating over DictRow |
| Дата | |
| Msg-id | 7b2272a8-de4d-bc95-1efc-84d69ea7c4c1@aklaver.com обсуждение исходный текст |
| Ответ на | RE: iterating over DictRow (David Raymond <David.Raymond@tomtom.com>) |
| Список | psycopg |
On 9/24/20 7:53 AM, 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 thinkwhat it "should" be is a little ambiguous. But you can always either cast it to a dict, or iterate over .keys() if youwant the field names. > > for field in dict(the_dict): > ... > or > for field in the_dict.keys(): > ... > Except I think the_dict is actually the_list. I was just about to post a reply to my post saying that my use of the_dict was incorrect as I was actually iterating over a list. -- Adrian Klaver adrian.klaver@aklaver.com
В списке psycopg по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера