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?
but I have a small problem.  I have a piece of software 
Is this a Python program? Will you post it so we can see it?
that runs
Good - it is nice to have running software
and each iteration is one like
Like what?
It only runs once right now
Is that a problem?
there is only one line + the headers.  
In the input file??
I use the csv module to kill 
Kill?
the headers and import 
import in Python has a specific meaning. I don't think you mean import in the Python sense.
the one line.  

The problem is...I need to have it split the csv file
the file or the line following the headers?
 at some point. I need to first 20 items taken off 
Of what? To understand this we'd need to see an example of the csv file.
and then have the next 7 + the first 20 imported into the database
Huh? I know all of this makes sense to you but not to me. So you need to give me a much better picture.
then have it do this for the next 7 + the first 20...so on and so forth until hits the
end of the line.
    
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
Any ideas?
    
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

Reply via email to