Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
StringIO¶
from io import StringIOsio = StringIO("")
sio<_io.StringIO at 0x7ff1ec50e940>sio.write("hello world")11sio.getvalue()'hello world'BytesIO¶
You can write anything into a BytesIO. For example, you can pass a BytesIO to
pandas.DataFrame.to_parquetto write a pandas DataFrame to the BytesIO in the Parquet format. For more details, please refer to Pandas IO.
from io import BytesIObio = BytesIO()
bio<_io.BytesIO at 0x7ff1ec5340e0>bio.write(b"hello world")
bio<_io.BytesIO at 0x7ff1ec5340e0>bio.getvalue()b'hello world'