Python: bash-shell-like less functionality in the python shell
Hello,
Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells? Example: Code:
>>> import subprocess With thanks, Narnie |
Hi Narnie,
When I do this I do get the help page in a less-type viewer. I'm running ~$ python -V Python 2.6.5 on ubuntu 10.04. |
Quote:
I get less-type functionality in the bash shell, but not in the IDLE python shell. However, I'll check IDLE to see if there is a command line option to start it with python -V. That's a great tip :) Thank you, Narnie |
Hmm. python -V simply displays the version of Python that you're running; I was thinking perhaps you were running an older version of Python.
I somewhat suspect that the IDLE shell doesn't actually enable what you're looking to do 8/ Try using ipython (in the universe; sudo apt-get install ipython). It combines some of the best aspects of the bash shell, python interpreter, and IDLE - for example you can navigate directories with commands such as cd and ls, and you can enter in Python code and run scripts (using the "run" command, eg > run test.py). And, it displays "help" as you want it to! Basically, they simply implemented the python interpreter on top of a normal shell. Another option I haven't tried before is bpython, which looks really interesting; it also supplies syntax highlighting (I thought ipython provided syntax highlighting, but I just installed it here on my work computer and it apparently doesn't have it). |
Quote:
You are very kind to provide me so much followup. I have done some reading and it is in fact that the IDLE shell isn't a "proper" shell. I will look into you solution when I get home. I'm always interested in trying in out and it's being in the repos will make it even easier. Thanks very much for the suggestion. Yours, Narnie PS Hoping it does code completion!!! PPS Loving how it sound like it makes it easier to change working directory, etc. |
All times are GMT -5. The time now is 03:42 PM. |