public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrian Klaver <[email protected]>
To: Hagen Finley <[email protected]>
To: [email protected]
To: [email protected]
Subject: Re: BACK: Inserting a variable into cur.execute statement
Date: Sun, 20 Dec 2020 16:57:07 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

On 12/20/20 3:13 PM, Hagen Finley wrote:
> Hello,
> 
> I finally got around to trying to implement this code and I am running 
> into an "IndexError: tuple index out of range" problem.
> 
> I am running a function with parameters from a list:
> 
> def def_acct_analysis(sht,acct):
>      print(param[par][0])
>      print(param[par][1])
>      sheet ="sheet"+str(sht)
>      print(sheet)
>      account = acct
>      print(account)
> 
> par =0 param = [(1,'ACCT0'),(2,'ACCT1'),(3,'ACCT2'),]
> 
> for pin param:
>      def_acct_analysis(param[par][0], param[par][1])
> 
>      par +=1


FYI, the above can be simplified to:

param = [(1,'ACCT0'),(2,'ACCT1'),(3,'ACCT2'),]

for p in param:
     def_acct_analysis(p[0], p[1])

> 
> #Print statements above output:
> 

-- 
Adrian Klaver
[email protected]





view thread (11+ 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: BACK: Inserting a variable into cur.execute statement
  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