UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 251: invalid start byte
<p>I am doing a small project.and i want to open a url.i tried with this</p>

<pre><code>url = 'http://www.ygdy8.net/html/gndy/dyzz/index.html'
content = urllib.request.urlopen(url).read() 

pat = re.compile('&lt;div class="title_all"&gt;&lt;h1&gt;&lt;front color=#008800&gt;.*?&lt;/a&gt;&gt;   &lt;/front&gt;&lt;/h1&gt;&lt;/div&gt;'+ '(.*?)&lt;td height="25" align="center" bgcolor="#F4FAE2"&gt; ',re.S)
txt = ''.join(pat.findall(content))
</code></pre>

<p>but this give me the error</p>

<pre><code>TypeError: can't use a string pattern on a bytes-like object
</code></pre>

<p>then i tried with </p>

<pre><code>txt = ''.join(pat.findall(content.decode()))
</code></pre>

<p>but there also an error </p>

<pre><code>    txt = ''.join(pat.findall(content.decode()))
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 251: invalid start byte
</code></pre>

<p>i looked for the answer but i dont know how to solve it.</p>