public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrian Klaver <[email protected]>
To: David Raymond <[email protected]>
To: [email protected] <[email protected]>
Subject: Re: iterating over DictRow
Date: Thu, 24 Sep 2020 08:51:52 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <AM0PR07MB4036EA8B58205084F30DA2AC87390@AM0PR07MB4036.eurprd07.prod.outlook.com>
References: <[email protected]>
	<AM0PR07MB4036EA8B58205084F30DA2AC87390@AM0PR07MB4036.eurprd07.prod.outlook.com>

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 think what it "should" be is a little ambiguous. But you can always either cast it to a dict, or iterate over .keys() if you want 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
[email protected]





view thread (12+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: iterating over DictRow
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox