Primary
io ⚬⃕ᵖʸ|Documentation|1st|20260122192714-00-⌔
io — Core tools for working with streams — Python 3.14.2 documentation
Overview
The
iomodule provides Python’s main facilities for dealing with various types of I/O. There are three main types of I/O: text I/O, binary I/O and raw I/O. These are generic categories, and various backing stores can be used for each of them. A concrete object belonging to any of these categories is called a file object. Other common terms are stream and file-like object.Independent of its category, each concrete stream object will also have various capabilities: it can be read-only, write-only, or read-write. It can also allow arbitrary random access (seeking forwards or backwards to any location), or only sequential access (for example in the case of a socket or pipe).
All streams are careful about the type of data you give to them. For example giving a
strobject to thewrite()method of a binary stream will raise aTypeError. So will giving abytesobject to thewrite()method of a text stream.Changed in version 3.3: Operations that used to raise
IOErrornow raiseOSError, sinceIOErroris now an alias ofOSError.Printed 2026-06-28.
(echo:: @ ᯤ)
Link to original
Secondary
• • •