Sign in

UnicodeDecodeError: 'utf-8' codec can't decode bytes

rshibley edited in Sun, 10 Oct 2021

When crawling the web address with Python 3, I always encounter this problem. The code of the web page I crawled is UTF-8, but I always say that there is something wrong with my code. I searched for many answers, but I still can't solve it. I hope you can help solve it. Thank you. The code is as follows: url = ' http://www.111abcd.com/655/%E... 'response = requests.get (url) response.encoding = "utf-8"print( response.text )

Finally, thank you again.

2 Replies
commented on Mon, 11 Oct 2021

from requests import getr = get(url). textr.encode ('utf-8')

commented on Mon, 11 Oct 2021

UTF-8, GBK, GB2312 try one by one

lock This question has been locked and the reply function has been disabled.