Read file from line 2 or skip header row
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Music Box Puzzles
--
Chapters
00:00 Question
00:19 Accepted answer (Score 569)
00:30 Answer 2 (Score 108)
00:40 Answer 3 (Score 30)
00:57 Answer 4 (Score 18)
01:12 Thank you
--
Full question
https://stackoverflow.com/questions/4796...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #fileio
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Music Box Puzzles
--
Chapters
00:00 Question
00:19 Accepted answer (Score 569)
00:30 Answer 2 (Score 108)
00:40 Answer 3 (Score 30)
00:57 Answer 4 (Score 18)
01:12 Thank you
--
Full question
https://stackoverflow.com/questions/4796...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #fileio
#avk47
ACCEPTED ANSWER
Score 584
with open(fname) as f:
next(f)
for line in f:
#do something
ANSWER 2
Score 111
f = open(fname,'r')
lines = f.readlines()[1:]
f.close()
ANSWER 3
Score 22
If slicing could work on iterators...
from itertools import islice
with open(fname) as f:
for line in islice(f, 1, None):
pass
ANSWER 4
Score 9
f = open(fname).readlines()
firstLine = f.pop(0) #removes the first line
for line in f:
...