CSV without first line?

John Machin sjmachin at lexicon.net
Sun Jul 15 00:28:48 EDT 2007


On Jul 15, 1:30 pm, "Sebastian Bassi" <sba... at clubdelarazon.org>
wrote:
> Hi,
>
> In my CSV file, the first line has the name of the variables. So the
> data I want to parse resides from line 2 up to the end. Here is what I
> do:
>
> import csv
> lines=csv.reader(open("MYFILE"))
> lines.next() #this is just to avoid the first line
> for line in lines:
>     DATA PARSING
>
> This works fine. But I don't like to do "lines.next()" just to get rid
> of the first line. So I wonder if the reader function on the csv
> module has something that could let me parse the file from the second
> line (w/o doing that lines.next()).
>

Why do you wonder, instead of looking in the manual?






More information about the Python-list mailing list