Re: ypeError: decoding str is not supported

2019-09-28 Thread Paul Moore
On Sat, 28 Sep 2019 at 10:53, Peter Otten <__pete...@web.de> wrote: > > Hongyi Zhao wrote: > > > Hi, > > > > I have some code comes from python 2 like the following: > > > > str('a', encoding='utf-8') > > This fails in Python 2 > > >>> str("a", encoding="utf-8") > Traceback (most recent call last):

Re: ypeError: decoding str is not supported

2019-09-28 Thread Peter Otten
Hongyi Zhao wrote: > Hi, > > I have some code comes from python 2 like the following: > > str('a', encoding='utf-8') This fails in Python 2 >>> str("a", encoding="utf-8") Traceback (most recent call last): File "", line 1, in TypeError: str() takes at most 1 argument (2 given) ...unless yo

ypeError: decoding str is not supported

2019-09-28 Thread Hongyi Zhao
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 "", line 1, in TypeError: decoding str is not supported How to fix it? -- https://m