Limit Lines of Output
Joshua Landau
joshua.landau.ws at gmail.com
Tue Jun 25 16:31:52 EDT 2013
On 25 June 2013 21:22, Bryan Britten <britten.bryan at gmail.com> wrote:
> Ah, I always forget to mention my OS on these forums. I'm running Windows.
Supposedly, Windows has "more"
[http://superuser.com/questions/426226/less-or-more-in-windows],
For Linux+less; this works:
from subprocess import Popen, PIPE
less = Popen("less", stdin=PIPE)
less.stdin.write(b"\n".join("This is line number
{}".format(i).encode("UTF-8") for i in range(1000)))
less.wait()
More information about the Python-list
mailing list