I\'m using a for loop to read a file, but I only want to read specific lines, say line #26 and #30. Is there any built-in feature to achieve this?
Thanks
How about this:
>>> with open('a', 'r') as fin: lines = fin.readlines() >>> for i, line in enumerate(lines): if i > 30: break if i == 26: dox() if i == 30: doy()