Silly question, where is read() documented?

Terry Reedy tjreedy at udel.edu
Sat Aug 29 21:29:20 EDT 2020


On 8/29/2020 12:18 PM, Chris Green wrote:
> Well it sounds a silly question but I can't find the documentation for
> read().  It's not a built-in function and it's not documented with
> (for example) the file type object sys.stdin.

sys.stdin is of no particular type, but must at least have a .read method.

> So where is it documented?  :-)

 >>> import sys; sys.stdin
should give a hint.  In the standard REPL,

<_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>

As others said, actually look in the io module doc.  You might spend 
some time reading the doc to get an idea of what is going on.  If you 
run from IDLE, you currently get

<idlelib.run.StdInputFile object at 0x00000243F6D6FBB0>
(I should make that more like the REPL answer.)

-- 
Terry Jan Reedy



More information about the Python-list mailing list