Here's a nerve-racking and truthful article on the hidden complexity when writing a truly portable and solid CSV parser. Makes you think twice before writing your own CSV parser like this:
for line in file: tokens = line.split(',')
Trust the Python standard library and do this instead when parsing CSV files:
The csv module can feel over-engineered and complicated at times. However, parsing CSV is not entirely trivial, unless you have the luxury of writing both the CSV writer and reader. Then, you might be able to get away with very simple parsing techniques.
Published: 05-30-2014 05:23:09