Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
import io # In-memory text file (no disk I/O) buf = io.StringIO() buf.write("Hello ") buf.write("World ") buf.seek(0) print(buf.read()) # In-memory binary file bbuf = io.BytesIO() bbuf.write(b"\x89PNG\r ") bbuf.seek(0) print(bbuf.read(4)) # b'\x89PNG'
Result
Open