ypeError: decoding str is not supported

Hongyi Zhao hongyi.zhao at gmail.com
Sat Sep 28 04:55:13 EDT 2019


Hi,

I have some code comes from python 2 like the following:

str('a', encoding='utf-8')

But for python 3, this will fail as follows:

>>> str('a', encoding='utf-8')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: decoding str is not supported


How to fix it?





More information about the Python-list mailing list