RE: BACK: Inserting a variable into cur.execute statement
От | |
---|---|
Тема | RE: BACK: Inserting a variable into cur.execute statement |
Дата | |
Msg-id | 1a5001d6d737$91f209e0$b5d61da0$@datasundae.com обсуждение исходный текст |
Ответ на | Re: BACK: Inserting a variable into cur.execute statement (Adrian Klaver <adrian.klaver@aklaver.com>) |
Ответы |
Re: BACK: Inserting a variable into cur.execute statement
|
Список | psycopg |
Interesting - thank you Adrian. -----Original Message----- From: Adrian Klaver <adrian.klaver@aklaver.com> Sent: Sunday, December 20, 2020 5:57 PM To: Hagen Finley <hagen@datasundae.com>; psycopg@lists.postgresql.org; psycopg@postgresql.org Subject: Re: BACK: Inserting a variable into cur.execute statement 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 adrian.klaver@aklaver.com
В списке psycopg по дате отправления: