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.
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.