[Tutor] sqlite3 lists to database conversion/ using python variables in sqlite3

2008-11-19 Thread amit sethi
Hi , i am trying to learn python and this is my first time with any databases . I am using sqlite3 to create a database of my music files and its metadata tags so here is what i wanted to do . Two list one of the attributes and one of their values ,how do i put it in the database.Here is a simple

Re: [Tutor] sqlite3 lists to database conversion/ using python variables in sqlite3

2008-11-19 Thread शंतनू (Shantanoo)
On Wed, Nov 19, 2008 at 4:48 PM, amit sethi [EMAIL PROTECTED] wrote: Hi , i am trying to learn python and this is my first time with any databases . I am using sqlite3 to create a database of my music files and its metadata tags so here is what i wanted to do . Two list one of the attributes

Re: [Tutor] sqlite3 lists to database conversion/ using python variables in sqlite3

2008-11-19 Thread Kent Johnson
On Wed, Nov 19, 2008 at 6:18 AM, amit sethi [EMAIL PROTECTED] wrote: list1=['hello','hi'] list2=['a','b'] c.execute('''create table ABC(hello text,hi text)''') list1_value= ,.join(list1) list2_value= ,.join(list2) c.execute('''insert into ABC (%s) values (%s)''')%(list1_value,list2_value)

Re: [Tutor] sqlite3 lists to database conversion/ using python variables in sqlite3

2008-11-19 Thread Kent Johnson
On Wed, Nov 19, 2008 at 7:21 AM, amit sethi [EMAIL PROTECTED] wrote: Thanks Kent , very useful reply but the thing is i actually want to use this in a program that stores ID3 tags and they are broken more usually than not .. so I actually don't know what keys/attributes i would be sending can I

Re: [Tutor] sqlite3 lists to database conversion/ using python variables in sqlite3

2008-11-19 Thread Kent Johnson
On Wed, Nov 19, 2008 at 6:48 AM, शंतनू (Shantanoo) [EMAIL PROTECTED] wrote: You may try: c.execute(insert into ABC(%s) values('%s') % (list1_value, list2_value)) This is a bad idea for reasons I gave in a previous email. Kent ___ Tutor maillist -