Blog Archive

Tuesday, May 1, 2012

Reading CSV files

Python has a csv reader. It converts each line in the csv file into a list.

The cvs reader is able to interpret two default versions or 'dialects' of csv
1)comma
2)tab
If you have another type of delimiter you need to create a brand new dialect. Take the below csv file:

Creature;Legs;Eyes
Dog;4;2
Cyclops;2;1
Spider;8;6

We can read the above by:

Happy data munging.

No comments:

Post a Comment