Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.035 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'python': 0.11; 'windows': 0.15; 'ah,': 0.16; 'bryan': 0.16; 'subject:Lines': 0.16; 'windows:': 0.16; 'wrote:': 0.18; 'import': 0.22; 'skip:l 30': 0.24; 'skip:{ 20': 0.24; 'mention': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; '25,': 0.31; 'pipe': 0.31; 'running': 0.33; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'more': 0.64; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=33g8WW26BqkLeMm+wTYlYn14KBwtYwFlB6Qn+H6JFbA=; b=ATYJmSkJlUdc0q2+xcyDOO4vV8f/GhIMjKo3/xirHxhSD7+WKaIvqCZ8vyhw4uN7Uh 3XJ3wj/Le78ZHE1J6MvHYerDmDPgR+vWYrlJwbd5rhZkHK8N96aU+uuHsM9jBoVANVoN 92ozQCCHYizNFHSwFua+dOVzpEoFdeODJn732/x67iYxwyKDMvBd6sGu9ffArNSK0VW0 UyG+IZfqa6awF738jQ08N93YrpQMPUXHAApoRPt8JECHu7MjnjvQeRyRtWtsadEqStJv 4luAZTnCWWYA4TSkTqnwhXluBKfZoQwMBzE3GUk+dj6tdOYtBFYTH7QhvDIXxJfQ4C1e Rwiw== X-Received: by 10.68.189.199 with SMTP id gk7mr646022pbc.208.1372192812901; Tue, 25 Jun 2013 13:40:12 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <0cb638ec-a4bd-4a45-b98c-a7c76996bab7@googlegroups.com> <842bc651-0bed-45df-9a29-2049279f4434@googlegroups.com> From: Ian Kelly Date: Tue, 25 Jun 2013 14:39:30 -0600 Subject: Re: Limit Lines of Output To: Python Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372192816 news.xs4all.nl 15892 [2001:888:2000:d::a6]:47942 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49190 On Tue, Jun 25, 2013 at 2:31 PM, Joshua Landau wrote: > On 25 June 2013 21:22, Bryan Britten 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() Or simply: $ python my_script.py | less It works the same way in Windows: C:\> python my_script.py | more