if read_range is None:
    for line in infile:
        line = line.rstrip().split(delimiter)
for item in line:
    yield dtype(item)
else:
    counter = 0
for line in infile:
    if counter < read_range[0]:
        counter += 1
else:
    counter += 1
чтение строк большого файла csv в python