Limit Lines of Output

Gene Heskett gheskett at wdtv.com
Tue Jun 25 17:48:13 EDT 2013


On Tuesday 25 June 2013 17:47:22 Joshua Landau did opine:

> 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],

Yes, but less is more than more.
 
> 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()


Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
My views 
<http://www.armchairpatriot.com/What%20Has%20America%20Become.shtml>
Campbell's Law:
	Nature abhors a vacuous experimenter.
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
         law-abiding citizens.



More information about the Python-list mailing list