I should say I\'m looking for a solution to the problem of viewing output that does not fit on your screen. For example, range(100) will show the last 30ish lin
def less(s, line_count = 5):
lines = []
for i, line in enumerate(s.split('\n'), 1):
lines.append(line)
if (i % line_count) == 0:
yield '\n'.join(lines)
lines = []
if lines:
yield '\n'.join(lines)