Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-09-2009, 05:28 AM   #1
LQ Newbie
Registered: Sep 2009
Posts: 1

Rep: Reputation: 0
Question inserting the content of a python list to a mysql database

I am new to working in linux though have abit of exposure in working on a mysql database. Am working on a project and some part of the script is able to read for me a python list which i use in the main program to give me
seq = [10,12,13,14,15,16,17,18]

am trying to use use a for loop to write back the content of the list to a colunm in the database

for x in seq:
sql_stm = 'insert into testinsert (time_after) values (%d)', (x)

but keep getting an error. Can someone help me on how i can write the content of the list to the column time-after
Old 09-09-2009, 07:51 AM   #2
Registered: Feb 2005
Distribution: Ubuntu, CentOS
Posts: 585

Rep: Reputation: 35
Is x a Tuple now, and not an element of the list?

What's the error?
Suggest putting code samples in code blocks, because your example's indentation is wrong. You'd be getting an error from that alone.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
store list items written in cgi script to mysql database gsr_kashyap Programming 5 01-28-2009 02:08 AM
Mailing list in a MySQL database Hjalte Linux - Server 2 09-02-2008 03:41 AM
OOffice: Inserting PDF, as link with real page content, and references , how ?? frenchn00b Linux - General 0 11-21-2007 05:26 PM
Problem Inserting Data In A Mysql Database Using PHP Dapernia Programming 5 09-17-2007 11:05 AM
Inserting element to a list of list in C suwandy_chandra Programming 2 03-09-2004 04:08 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:36 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration