Conn = sqlite3. Connect('/path/to/your/sqlite_file. Db') c = conn.cursor() for item in my_list: c.
Execute('insert into tablename values (?,? ,? )', item).
Thanks Dyno and Dominic - But it's not working - this is what i'm trying ----------- for record in list: print "--->",record cursor. Execute("insert into process values (?,? ,?)",record); ----------- getting error – lakshmipathi Jan 19 '10 at 11:59 @lakshmipathi - What error do you get?
– Dominic Rodger Jan 19 '10 at 12:18 I have try, except part - try part will have for loop and execute stmt and except part has single message saying "insert failed" ...it just prints the message from except part and quits. How to debug this more effectively? – lakshmipathi Jan 19 '10 at 12:47 @lakshmipathi: If your exception handling is chewing up the error message then it isn't really handling it... – Ignacio Vazquez-Abrams Jan 21 '10 at 7:13 how to print error number .. atleast that would provide some hint – lakshmipathi Jan 21 '10 at 7:41.
Adapted from docs.python.org/library/sqlite3.html: # Larger example for t in ('2006-03-28', 'BUY', 'IBM', 1000, 45.00), ('2006-04-05', 'BUY', 'MSOFT', 1000, 72.00), ('2006-04-06', 'SELL', 'IBM', 500, 53.00), : c. Execute('insert into stocks values (?,? ,?
,? ,? )', t).
There's a better way # Larger example rows = ('2006-03-28', 'BUY', 'IBM', 1000, 45.00), ('2006-04-05', 'BUY', 'MSOFT', 1000, 72.00), ('2006-04-06', 'SELL', 'IBM', 500, 53.00), : c. Executemany('insert into stocks values (?,? ,?
,? ,? )', rows ) connection.commit() edit: fixed typo.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.