Search code examples
pythonpydoc

Error when calling `python -m pydoc read()`


I'm learning python from LPTH.

In exercise 15 in study drills, I'm supposed to know what read() does using pydoc; However when I try to do so with, python -m pydoc read(), I get an error like this.

an expression is expected after << ( >> 
at line : 1 character 23  
python -m pydoc read ( <<<< )  
 *category info : parser error : (:), parentcontainsErrorRecordException  
 * FullyQualifiedErrorID: ExpectedExpression 

I don't understand what I did wrong.

I used the same way for: raw_input,os,open, but apparently I am doing something wrong with read().


Solution

  • You probably want this:

    python -m pydoc read
    

    But that will give you: no Python documentation found for 'read'

    In what context are you trying to use read()... Example: to open a file and read and see associated docs, use

    python -m pydoc file