I’m essentially trying to achieve this:
>>>print "SOME_VERY_LONG_TEXT" | more
Of course, it doesn’t work in Python 2.7(IDLE).
Also, I tried pager 1.2‘s page() function, but I don’t know how to get it to work correctly.
Any ideas?
[UPDATE]
I found a lazy way, as follows:
import pydoc
pydoc.pager("SOME_VERY_LONG_TEXT")
Writing something terminal and os independent might be a bigger task.
But if you can get the height of the terminal then you can use something like this this
Assuming your input is a generator/list of line seperated text, or else you can call text.split(‘\n’) before calling this function
Also there is a pager module on pypy haven’t used it but the author says it was supposed to be included in the standard library.