My personal first choice (for writing such things) would be the Python CSV reader module
(See, for example Trying to parse csv file into variables)
( I first met it when I had to process a 4Gb CSV file in an unexpected hurry – to my surprise it worked perfectly for that, and has always served well since )