7 lines
166 B
Python
7 lines
166 B
Python
from itertools import islice
|
|
|
|
with open('xxx.txt') as f:
|
|
try:
|
|
line = next(islice(f, 6, 7))
|
|
except StopIteration:
|
|
print('Not 7 lines in file')
|