Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
StringIO¶
In [1]:
from io import StringIO
In [2]:
sio = StringIO("")
sio
Out[2]:
In [3]:
sio.write("hello world")
Out[3]:
In [4]:
sio.getvalue()
Out[4]:
In [5]:
from io import BytesIO
In [6]:
bio = BytesIO()
bio
Out[6]:
In [7]:
bio.write(b"hello world")
bio
Out[7]:
In [8]:
bio.getvalue()
Out[8]:
In [ ]: