how to start reading at line X in python? -
actually read file this:
f = open("myfile.txt") line in f: #do s.th. line
what need start reading not @ first line, @ x line? (e.g. 5.)
an opened file object f
iterator. read (and throw away) first 4 lines , go on regular reading:
with open("myfile.txt", 'r') f: in xrange(4): next(f, none) line in f: #do s.th. line
Comments
Post a Comment