io

Stdlib — OS/FilePython 2.6+Intermediate

Core I/O tools: StringIO, BytesIO, and file I/O class hierarchy

Quick Info

Documentation
Official Docs
Python Version
2.6+
Dependencies
None — Python Standard Library
Install
Included with Python

Learn by Difficulty

Quick Example

python
from io import StringIO, BytesIO

# StringIO - text stream
sio = StringIO()
sio.write("Hello, ")
sio.write("World!")
print(sio.getvalue())

# BytesIO - binary stream
bio = BytesIO()
bio.write(b"Binary data")
print(bio.getvalue())

The io module is part of Python's standard library. Core I/O tools: StringIO, BytesIO, and file I/O class hierarchy.

Try in Playground

Tags

stdlibfile-iostreambuffer

Related Items