|
Member
Registered: Oct 2006
Distribution: Debian x64
Posts: 197
Rep:
|
python how to work with fake csv
I'd like to parse some data for use in an sql database (or work with it directly in Python). The data is currently in a pseudo-csv format (from xls); it only exports to pdf or xls. I'm trying to think of how I should go about parsing/ editing/ working with the data.
I am not asking for explicit code as much as thought processes and modules. I don't know how to approach the problem; I'm imagining readline , a lot of 'if, thens, fors, whiles', and globs. This does not seem appropriate.
The data comes from a file with columns (but not true columns or I think it would have exported to cvs better).
Basically, I'm interested in keeping student name as an entry with all the information for that particular student have each test 'math, reading, writing, science, social studies' have the fields associated with it 'objective, question, answer'
,,,,,,,,,,,,,,,,,,,,,,,,,.
,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,
9/26/08,,,,,,,,,,,,,,,,,,,,,,,,,
"Student Name:",,,"DOE, JOHN",,,,,,"TAKS Assessment Year:",,,,,"2007-2008 0408",,,,,"Current Grade Level: 16th Grade",,,,,,
"Gender:",,"M",,,,"Eco. Dis.:",,,"Y",,,"Migrant:",,"N",,,"Bilingual:",,,"N",,,"SpecialEd:",,"N"
"Ethnicity:",,"Hispanic",,,,,"Title 1:",,"N",,,"LEP:",,"N",,,"ESL:",,,"Y",,,"Gifted:",,"N"
"Test Grade:",,9,,,,"At Risk:",,,"Y",,,"Campus:",,"My HS",,,,,,,,,,,
"Mathematics",,,,,"Reading",,,,,,"Writing",,,,,"Science",,,,,,"Social Studies",,,
"Score Code",,,"S",,"Score Code",,,,"S",,"Score Code",,,,,"Score Code",,,,,,"Score Code",,,
"Nbr of MC Qst",,,52,,"Nbr of MC Qst",,,,33,,"Nbr of MC Qst",,,,,"Nbr of MC Qst",,,,,,"Nbr of MC Qst",,,
"MC Raw Correct",,,26,,"MC Raw Correct",,,,22,,"MC Raw Correct",,,,,"MC Raw Correct",,,,,,"MC Raw Correct",,,
"MC Pct Correct",,,"50.00",,"MC Pct Correct",,,,"66.67",,"MC Pct Correct",,,,,"MC Pct Correct",,,,,,"MC Pct Correct",,,
"Scale Score",,,"2,009",,"Scale Score",,,,"2,059",,"Scale Score",,,,,"Scale Score",,,,,,"Scale Score",,,
"Met Standard",,,"N",,"Met Standard",,,,"N",,"Met Standard",,,,,"Met Standard",,,,,,"Met Standard",,,
"Commended",,,"N",,"Commended",,,,"N",,"Commended",,,,,"Commended",,,,,,"Commended",,,
"Version",,,"E",,"Version",,,,"E",,"Version",,,,,"Version",,,,,,"Version",,,
"Obj","Qst",,"Ans",,"Obj","Qst",,,"Ans",,"Obj",,"Qst","Ans",,"Obj",,"Qst",,"Ans",,"Obj",,"Qst"," Ans"
1,15,,"+",,1,1,,,"+",,,,,,,,,,,,,,,,
1,18,,"+",,1,2,,,"+",,,,,,,,,,,,,,,,
1,25,,"B",,1,3,,,"D",,,,,,,,,,,,,,,,
1,29,,"B",,1,4,,,"+",,,,,,,,,,,,,,,,
1,38,,"F",,1,15,,,"+",,,,,,,,,,,,,,,,
2,5,,"+",,1,16,,,"+",,,,,,,,,,,,,,,,
2,10,,"+",,1,17,,,"B",,,,,,,,,,,,,,,,
2,22,,"+",,1,18,,,"J",,,,,,,,,,,,,,,,
2,28,,"G",,1,19,,,"+",,,,,,,,,,,,,,,,
2,50,,"+",,2,5,,,"D",,,,,,,,,,,,,,,,
3,7,,"+",,2,6,,,"+",,,,,,,,,,,,,,,,
3,11,,"C",,2,7,,,"D",,,,,,,,,,,,,,,,
3,31,,"+",,2,8,,,"G",,,,,,,,,,,,,,,,
3,42,,"+",,2,9,,,"+",,,,,,,,,,,,,,,,
3,48,,"F",,2,10,,,"+",,,,,,,,,,,,,,,,
4,17,,"+",,2,11,,,"D",,,,,,,,,,,,,,,,
4,21,,"+",,2,12,,,"+",,,,,,,,,,,,,,,,
4,36,,"+",,2,20,,,"+",,,,,,,,,,,,,,,,
4,45,,"+",,2,21,,,"+",,,,,,,,,,,,,,,,
4,52,,"J",,2,22,,,"+",,,,,,,,,,,,,,,,
5,1,,"+",,2,28,,,"J",,,,,,,,,,,,,,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