I have a csv file deliminated by ,.
The first line contains the report name, the second line contains the report data.
The headers are in line 3 and all the other rows are data.
How do I use the csv module to read the headers from line 3 instead of 1?
Below is what I have now.
import csv
f = open ("myfile.csv", "rb")
reader = csv.reader(f, delimiter=",")
headers = reader.next()
You can use itertools.islice to discard items from an iterator.
from itertools import islice
reader = islice(csv.reader(f, delimiter=","), 2, None)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With