Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just installed Python 2.7 and Python 3.2 on my Ubuntu 12.04 (32 bit).

sudo apt-get install python python-doc python3 python3-doc

I opened a Python 3 shell (is it called like that) typing python3 from a terminal. If I issue the command help('print') everything works fine and I can read the documentation.

However if I open a Python 2.7 shell (python from a terminal) when I type help('print') I get the following message:

no documentation found for 'print'

How can I get to use the documentation in Python 2.7 as well?

share|improve this question
up vote 3 down vote accepted

This looks like a bug of Python 2 as something like help("dir") works properly. It probably does not work because print is a special keyword, unlike Python 3. Stick to Python 3 or run the following command instead of help("print"):

share|improve this answer

That documentation is always installed , because it is embedded on the source files. The specified command does not work because in python2.7 print is both a statement and a function, so it may be confusing the help function.

If you use, for example help('os') or help("if") you should get the correct information:

$ python -c "help('if')"
The ``if`` statement

The ``if`` statement is used for conditional execution:

   if_stmt ::= "if" expression ":" suite
               ( "elif" expression ":" suite )*
               ["else" ":" suite]

It selects exactly one of the suites by evaluating the expressions one
by one until one is found to be true (see section *Boolean operations*
for the definition of true and false); then that suite is executed
(and no other part of the ``if`` statement is executed or evaluated).
If all expressions are false, the suite of the ``else`` clause, if
present, is executed.

So the documentation is installed and that behavior you see should be a bug.

share|improve this answer
help('if') works in a python shell too. It is just that help('print') works differently (read: does not show a help page): python2 -c "help('print')". – Lekensteyn Dec 20 '12 at 20:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.