Is there any replacement for python StringIO
class, one that will work with bytes
instead of strings?
It may not be obvious but if you used StringIO for processing binary data you are out of luck with Python 2.7 or newer.
Try io.BytesIO
.
As others have pointed out, you can indeed use StringIO
in 2.7, but BytesIO
is a good choice for forward-compatibility.