|
On Thu, Mar 20, 2008 at 03:16:05PM -0600, Spencer Parker wrote: I've interspersed a bunch of comments to show you how hard it has been to read and understand your problem description. After going thru it I think I understand the question. Please in the future try to express the question more clearly. I am trying to read a CSV file and the get that information into a MySQL database. I am able to do this You are able to do what? Read csv files? Insert into my SQL? Is this a Python program? Will you post it so we can see it?but I have a small problem. I have a piece of software Good - it is nice to have running softwarethat runs Like what?and each iteration is one like Is that a problem?It only runs once right now In the input file??there is only one line + the headers. Kill?I use the csv module to kill import in Python has a specific meaning. I don't think you mean import in the Python sense.the headers and import the one line. the file or the line following the headers?The problem is...I need to have it split the csv file Of what? To understand this we'd need to see an example of the csv file.at some point. I need to first 20 items taken off Huh? I know all of this makes sense to you but not to me. So you need to give me a much better picture.and then have the next 7 + the first 20 imported into the database Having waded thru all that I will make a guess: The csv file format is: Headers Line Data Line and Data Line looks like: item1,. item2, ... item20, data11, data12, ... data17, data21, data22, ... data27, etc. And you want to insert into the datbase: item1,. item2, ... item20, data11, data12, ... data17 item1,. item2, ... item20, data21, data22, ... data27 etc If I were you and my guesses above are correct I'd reduce the problem statement to: given a line from a csv file of the format: item1,. item2, ... item20, data11, data12, ... data17, data21, data22, ... data27, etc. How do I create a series of INSERT statements to insert into the database item1,. item2, ... item20, data11, data12, ... data17 item1,. item2, ... item20, data21, data22, ... data27 -- Bob Gailer 919-636-4239 Chapel Hill, NC |
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
