Python3 TypeError: initial_value must be str or None, not bytes

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.

posted @ 2018-10-10 00:50  vercont  阅读(391)  评论(0编辑  收藏  举报