quick and smart way for parsing a CSV file?

Hank soundwave56 at yahoo.ca
Wed Sep 3 16:42:24 EDT 2003


Hi, 

I have a CSV file from excel that looks like this (simplified):

name,description,type1,type2,name,filename
test1,this is a test,0.000,1.000,,
test2,another test,1.000,0.000,newname,filename
test3,this is a test,0.000,1.000,,
test4,this is a test,0.000,1.000,,
test5,this is a test,0.000,1.000,,
test6,this is a test,0.000,1.000,,



what i want at the end is a dictionary like

dict1[name] = test1
dict1[description] = "this is a test"
.
.
.
dict2[name] = test2
dict2[description] = "another test"

whats a fast and quick way of parsing it? Look for the first comma,
strip that entry out of the string, keep going? Thought there might be
some shortcuts.

Thanks




More information about the Python-list mailing list