DEV Community

Discussion on: How to Parse a Spreadsheet in Python

hamatti profile image
Juha-Matti Santala

One of the main benefits for using the csv library in Python is that it handles edge cases much more gracefully than a custom and naive "split by comma" approach.

A valid csv might look like this:

1,Jeremy Grifski,How to Parse a Spreadsheet
2,Juha-Matti Santala,"Quotes, they are great in csv"
Enter fullscreen mode Exit fullscreen mode

Here, the split-by-comma approach will actually trip up because it doesn't regard the quoted string as a field.

renegadecoder94 profile image
Jeremy Grifski Author

Good point! I’ll add that note to the first section.