Search notes:
Python: (some) _io types
w_ = open('w_' , 'w' )
wb = open('wb' , 'wb')
rb = open(__file__, 'rb')
def cls(obj):
print(' <- '.join( map(lambda t: '.'.join([t.__module__, t.__qualname__]), type(obj).mro())))
cls(w_)
cls(wb)
cls(rb)
The above code prints
_io.TextIOWrapper <- _io._TextIOBase <- _io._IOBase <- builtins.object
_io.BufferedWriter <- _io._BufferedIOBase <- _io._IOBase <- builtins.object
_io.BufferedReader <- _io._BufferedIOBase <- _io._IOBase <- builtins.object
_io.IOBase
_io.IOBase
is the (abstract) base class for all I/O related classes. IOBase
inherits from builtins.object
close() | |
closed | |
fileno() | |
flush() | |
isatty()()rr | |
readable() | |
readline(size=- 1, /) | |
readlines(hint=- 1, /) | |
seek(offset, whence=SEEK_SET, /) | |
seekable() | |
truncate(size=None, /) | |
writable() | |
writelines(lines, /) | Write the elements of the list lines . This method does not add new line characters! |
__del__() | |
Note that _io.IOBase
does not have read()
or write()
.
_io.BufferedIOBase
_io.BufferedIOBase
inherits from _io.IOBase
.
raw | |
detach() | |
read(size=- 1, /) | |
read1(size=- 1, /) | |
readinto(b, /) | |
readinto1(b, /) | |
write(b, /) | |
_io.BufferedReader
_io.BufferedReader
inherits from _io.BufferedIOBase
.
peek((size=0, /) | |
read(size=- 1, /) | |
read1(size=- 1, /) | |
_io.BufferedWriter
_io.BufferedWriter
inherits from _io.BufferedIOBase
.
_io.TextIOBase
_io.TextIOBase
inherits from _io.IOBase
encoding | |
errors | |
newlines | |
buffer | |
detach() | |
read(size=- 1, /) | |
readline(size=- 1, /) | |
seek(offset, whence=SEEK_SET, /) | |
tell() | |
write(s, /) | Writes the string s and returns the number of characters written |
_io.TextIOWrapper
_io.TextIOWrapper
inherits from _io.TextIOBase
.
line_buffering | |
write_through | |
reconfigure(*[, encoding][, errors][, newline][, line_buffering][, write_through]) | |