I am doing a small project.and i want to open a url.i tried with this
url = 'http://www.ygdy8.net/html/gndy/dyzz/index.html'
content = urllib.request.urlopen(url).read()
pat = re.compile('<div class="title_all"><h1><front color=#008800>.*?</a>> </front></h1></div>'+ '(.*?)<td height="25" align="center" bgcolor="#F4FAE2"> ',re.S)
txt = ''.join(pat.findall(content))
but this give me the error
TypeError: can't use a string pattern on a bytes-like object
then i tried with
txt = ''.join(pat.findall(content.decode()))
but there also an error
txt = ''.join(pat.findall(content.decode()))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 251: invalid start byte
i looked for the answer but i dont know how to solve it.