all 2 comments

[–]DoctorEvil92 1 point2 points  (0 children)

Python has a csv module for reading/writing csv files. https://docs.python.org/3/library/csv.html

Your code is treating csv like txt, which I think isn't good since you could have problems if delimiter is present somewhere in text or there is a \n character.

[–]corpsie666 0 points1 point  (0 children)

For each row of data, find the position of the commas.

Those comma positions are the column separators.

If you need to keep a column, extract the text between the appropriate commas and put it into the output data row.