473,830 Members | 2,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3975
"Alex K" <sp*********@gm ail.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.com wrote:
"Alex K" <sp*********@gm ail.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...@gm ail.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******@lexic on.netwrote:
On Jan 15, 7:35 am, "Alex K" <spaceout...@gm ail.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******@lexic on.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******@lexic on.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(tex t)

(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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3855
by: Logan | last post by:
Several people asked me for the following HOWTO, so I decided to post it here (though it is still very 'alpha' and might contain many (?) mistakes; didn't test what I wrote, but wrote it - more or less - during my own installation of Python 2.3 on Fedora Core 1 Linux for a friend of mine). Anyway, HTH, L.
20
5200
by: Matthew Thorley | last post by:
My friend sent me an email asking this: > I'm attemtping to decide which scripting language I should master and > was wondering if it's possible to do > these unixy awkish commands in python: > > How to find the amount of disk space a user is taking up: > > find / -user rprice -fstype nfs ! -name /dev/\* -ls | awk '{sum+=$7};\ > {print "User rprice total disk use = " sum}'
2
4550
by: Xah Lee | last post by:
Python Doc Problem Example: os.system Xah Lee, 2005-09 today i'm trying to use Python to call shell commands. e.g. in Perl something like output=qx(ls) in Python i quickly located the the function due to its
0
3489
by: Cameron Simpson | last post by:
On 17Aug2008 21:25, John Nagle <nagle@animats.comwrote: Because $HOSTNAME is a bash specific variable, set by bash but NOT EXPORTED! Like $0 and a bunch of other "private" variables, subprocesses do not inherit this value. From "man bash": Shell Variables The following variables are set by the shell:
0
9791
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10771
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10487
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10525
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10202
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9313
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
4411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3958
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.