What's the best way to extract 2 values from a CSV file from each row systematically?

Neil Cerutti neilc at norwich.edu
Mon Sep 23 13:20:41 EDT 2013


On 2013-09-23, quarantinemiles at gmail.com <quarantinemiles at gmail.com> wrote:
> Hey guys,
>
> I'm a little new to Python, and am still learning!
>
> I'm test building a web scraper that extracts prices from a
> website, based on two values I want to extract from a CSV file.
> The CSV has at least 1000 rows, an example:
>
> 0,0,KGD,0,DME,0,,0,0
>
> The values I want to extract are KGD and DME (columns 3 and 5).

Use the csv module.

http://docs.python.org/2/library/csv.html

-- 
Neil Cerutti



More information about the Python-list mailing list