Hi Robert,

On 12/12/15 23:01, Robert wrote:
I want to use pydoc as some online tutorial shows, but it cannot run as
below. What is wrong?

"some online tutorial"?

import pydoc
pydoc
<module 'pydoc' from 'C:\Python27\lib\pydoc.pyc'>

Correct - in the interactive interpreter, typing the name of an object prints its value. You have imported a module and then typed its name.

pydoc sys
SyntaxError: invalid syntax
import sys
pydoc sys
SyntaxError: invalid syntax

In both of these, there  is no operator after "pydoc", so what does it mean?

help(pydoc)
Help on module pydoc:
......

Instead of omitting the result of that, read it!


FWIW, The relevant part based on what I _think_ you're trying to do (as you didn't include the URL of your "some online tutorial") is probably this part:

"""
DESCRIPTION
In the Python interpreter, do "from pydoc import help" to provide online
    help.  Calling help(thing) on a Python object documents the object.

    Or, at the shell command line outside of Python:

    Run "pydoc <name>" to show documentation on something.
"""

E.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to