python – re.search().TypeError: cannot use a string pattern on a bytes-like object

python – re.search().TypeError: cannot use a string pattern on a bytes-like object

re needs byte patterns (not string) to search bytes-like objects. Append a b to your search pattern like so: b<title>(.*?)</title>

If you could add html=html.decode(utf-8), I think it will be ok.

python – re.search().TypeError: cannot use a string pattern on a bytes-like object

Leave a Reply

Your email address will not be published.