Peter Otten wrote:

> You are still reading the complete csv file. Assuming
> 
> (1) the first row of the csv contains the column names
> (2) you want to skip the first five rows of data
> 
> you'd have to write
> 
> reader = csv.Reader(file)

Sorry, I meant DictReader, not Reader.

> line = 0
> while line < 5:
>     next(reader)
>     line += 1
> for row in reader:
>     .... # process csv row
> 
> A simpler alternative is to use itertools.islice():
> 
> for row in itertools.islice(reader, 5, None):
>     ... # process csv row


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to