Sep-13-2018, 09:07 AM
First of all, my English is poor. So please forgive me.
I was coding with python3. Specific version → Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
when I used 'urllib.parse.unquote' to unquote data, it throw a exception like this:
So I tried to make the variable to 'bytes-like object', but it did not work.
In the end, I found that this function actually needed a 'str' but not a 'bytes-like object'.
Is this error message wrong? Or I just misunderstand what it means.
I was coding with python3. Specific version → Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
when I used 'urllib.parse.unquote' to unquote data, it throw a exception like this:
Error:Error:
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
parse.unquote(bytes_test)
File "D:\Python3\lib\urllib\parse.py", line 609, in unquote
if '%' not in string:
TypeError: a bytes-like object is required, not 'str'
In my understanding, this message told me: "I need a 'bytes-like object' but you give me a 'str'. So it's wrong."So I tried to make the variable to 'bytes-like object', but it did not work.
In the end, I found that this function actually needed a 'str' but not a 'bytes-like object'.
Is this error message wrong? Or I just misunderstand what it means.


