Why doesn't response pydoc on my Python 2.7?

Ben Finney ben+python at benfinney.id.au
Sat Dec 12 18:18:01 EST 2015


Robert <rxjwg98 at gmail.com> writes:
> I want to use pydoc as some online tutorial shows

Which online tutorial? Please give the URL to the page that instructs
you to use ‘pydoc’ in that manner.
> >>> import pydoc

Allows you to use, in Python code, the ‘pydoc’ module by name.
> >>> pydoc
> <module 'pydoc' from 'C:\Python27\lib\pydoc.pyc'>

Accesses the ‘pydoc’ name. Because this is the interactive Python shell,
it displays the result of that access: a module object.
> >>> pydoc sys
> SyntaxError: invalid syntax
> >>> import sys
> >>> pydoc sys
> SyntaxError: invalid syntax

Yes, using two names in a row like that is invalid Python syntax.
> >>> help(pydoc)
> Help on module pydoc:
> ......

Gives help from the module object you access through the name ‘pydoc’.
I suspect the tutorial instructs you to invoke the ‘pydoc’ *command* on
your operating system, not use it within Python.
But I can only guess, until you show us which page from which tutorial
you're referring to.
-- 
 \ “Technology is neither good nor bad; nor is it neutral.” |
 `\ —Melvin Kranzberg's First Law of Technology |
_o__) |
Ben Finney


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /