response.read() returns an instance of bytes while StringIO is an in-memory stream for text only. Use BytesIO instead.
The StringIO and cStringIO modules are gone. Instead, import the io module and use io.StringIO or io.BytesIO for text and data respectively.
本文介绍在处理二进制数据时,如何正确使用BytesIO替代StringIO。StringIO仅适用于文本数据,而BytesIO则适用于二进制数据。文章强调了在Python中处理不同数据类型时选择合适模块的重要性。

8997

被折叠的 条评论
为什么被折叠?



