I am reading lines from a file and then traversing each overlapping substring of k size in a loop, then process these strings. What would be a better (more efficient and elegant) way to read in the substrings? How can I make a list without the loop?
for line in lines[1::4]:
startIdx = 0
while startIdx + k <= len(line):
substring = line[startIdx:(startIdx+k)]
countFromSb[substring] = countFromSb.get(substring, 0) + 1
startIdx += 1
linesProcessed += 1