variable hell

bruno modulix onurb at xiludom.gro
Thu Aug 25 10:59:26 EDT 2005


Nx wrote:
> Thanks for the many replies
> 
>  here is an example for what it will be used for , in this case
>  fixed at 31 fieldvalues:
> 
>  inputvalues=(s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,
>         s26,s27,s28,s29,s30,s31)
>    MYINSERTSELECT = "INSERT INTO
> ADDRESS(ALIAS,COMPANY,ADDRESSLI1,ADDRESSLI2,ADDRESSCO,TOWN,ZIP,COUNTRY,TEL1,TEL2,FAX,EMAIL,INTERNET,PERSON1,TITLE1,RES1,PERSON2,TITLE2,RES2,PERSON3,TITLE3,RES3,PERSON4,TITLE4,RES4,PERSON5,TITLE5,RES5,PRODALIAS,PAGER,TLX,ADDMEMO)
>    VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
>    
>    con1.commit() 
>    cur = con1.cursor()
>    try :
>     cur.execute(MYINSERTSELECT,inputvalues)

If I refer to your original post, there's someting I dont understand:
"""
I am unpacking a list into variables, for some reason they need to be
 unpacked into variable names like a0,a1,a2....upto aN whatever is
 in the list.
"""

Why unpack inputvalues if your next step is to pack'em back again ? Or
what did I miss ?


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list