471,344 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,344 software developers and data experts.

paging in python shell

Hello,

Does anyone know if the python shell supports paging or if I should
look into iPython? Thank you so much.

Alex
Jan 12 '08 #1
7 3769
"Alex K" <sp*********@gmail.comwrote:
>
Does anyone know if the python shell supports paging or if I should
look into iPython? Thank you so much.
"Paging" is an overloaded term. What do you mean, exactly? Do you mean
something like piping the output into "more"? The Python shell does that
for the "help" command, but maybe you could post a more precise example of
what you want.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jan 13 '08 #2
Hi Tim,

Yes I mean piping the output into "more" for example.

Alex

On 14/01/2008, Tim Roberts <ti**@probo.comwrote:
"Alex K" <sp*********@gmail.comwrote:

Does anyone know if the python shell supports paging or if I should
look into iPython? Thank you so much.

"Paging" is an overloaded term. What do you mean, exactly? Do you mean
something like piping the output into "more"? The Python shell does that
for the "help" command, but maybe you could post a more precise example of
what you want.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list
Jan 14 '08 #3
On Jan 15, 7:35 am, "Alex K" <spaceout...@gmail.comwrote:
Hi Tim,

Yes I mean piping the output into "more" for example.
Why don't you "suck it and see"???

E.g.

C:\junk>copy con demomore.py
for i in range(100):
print 'line', i
^Z
1 file(s) copied.

C:\junk>python demomore.py | more
line 0
line 1
line 2
line 3
line 4
[snip]
line 50
line 51
line 52
line 53
line 54
line 55
line 56
-- More --
Jan 14 '08 #4
Thanks John, but would it be possible to remain in the python interpreter?

On 14/01/2008, John Machin <sj******@lexicon.netwrote:
On Jan 15, 7:35 am, "Alex K" <spaceout...@gmail.comwrote:
Hi Tim,

Yes I mean piping the output into "more" for example.

Why don't you "suck it and see"???

E.g.

C:\junk>copy con demomore.py
for i in range(100):
print 'line', i
^Z
1 file(s) copied.

C:\junk>python demomore.py | more
line 0
line 1
line 2
line 3
line 4
[snip]
line 50
line 51
line 52
line 53
line 54
line 55
line 56
-- More --
--
http://mail.python.org/mailman/listinfo/python-list
Jan 14 '08 #5
John Machin <sj******@lexicon.netwrites:
C:\junk>python demomore.py | more
Your example uses the OS shell to invoke a pager on the output of the
Python process. The OP was asking about paging *within* the Python
shell.

To my knowledge there's nothing in the default Python shell that
enables what the OP is asking for. There are other Python shells, e.g.
Idle, ipython, or a Python window inside Emacs, that may be better
suited.

--
\ "Compulsory unification of opinion achieves only the unanimity |
`\ of the graveyard." -- Justice Roberts in 319 U.S. 624 (1943) |
_o__) |
Ben Finney
Jan 14 '08 #6
Thanks it's good to know. iPyton looks really neat.

On 15/01/2008, Ben Finney <bi****************@benfinney.id.auwrote:
John Machin <sj******@lexicon.netwrites:
C:\junk>python demomore.py | more

Your example uses the OS shell to invoke a pager on the output of the
Python process. The OP was asking about paging *within* the Python
shell.

To my knowledge there's nothing in the default Python shell that
enables what the OP is asking for. There are other Python shells, e.g.
Idle, ipython, or a Python window inside Emacs, that may be better
suited.

--
\ "Compulsory unification of opinion achieves only the unanimity |
`\ of the graveyard." -- Justice Roberts in 319 U.S. 624 (1943) |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
Jan 15 '08 #7
En Mon, 14 Jan 2008 21:05:38 -0200, Ben Finney
<bi****************@benfinney.id.auescribi�:
To my knowledge there's nothing in the default Python shell that
enables what the OP is asking for. There are other Python shells, e.g.
Idle, ipython, or a Python window inside Emacs, that may be better
suited.
Yes, there is. Thanks to Tim Roberts who menctioned that the builtin help
system implements paging internally, I looked at it. It's easy to use (but
maybe too late for the OP):

Let Python determine the best pager available:

import pydoc
pydoc.pager(text)

(it may pipe the text into an external program like less or more). Or
explicitely use the builtin pager:

import pydoc
pydoc.ttypager(text)
--
Gabriel Genellina

Jan 21 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.