The problem of utf-8' reporting an error I dont know what is wrong

generate an error such as" utf-8" codec can"t decode byte 0x8b in position 1: invalid start byte
my code:
from urllib import request
url = "http://odds.500.com/fenxi/yazhi-749525.shtml"
headers = {

"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0"
}

req = request.Request (url)
resp = request.urlopen (req)
a = resp.read ()
print (a.decode ("utf-8"))-sharp-sharp-sharp problem description

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Apr.11,2021

The

page has been compressed by gzip and needs to be decompressed:

from urllib import request
import gzip

url = "http://odds.500.com/fenxi/yazhi-749525.shtml"
headers = {

"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0"
}
req = request.Request(url)
resp = request.urlopen(req)
f = gzip.decompress(resp.read())
print(f.decode('gbk'))
< hr >

it is more recommended to directly use requests library:

import requests
url = "http://odds.500.com/fenxi/yazhi-749525.shtml"
content = requests.get(url).content

print(content.decode('gbk'))
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eaf62c-48007.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eaf62c-48007.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?