Read file from line 2 or skip header row

super9 picture super9 · Jan 25, 2011 · Viewed 340.3k times · Source

How can I skip the header row and start reading a file from line2?

Answer

SilentGhost picture SilentGhost · Jan 25, 2011
with open(fname) as f:
    next(f)
    for line in f:
        #do something