I am running this code using Python 3.2.3:
regex = '<title>(.+?)</title>'
pattern = re.compile(regex)
and then searching the pattern using findall:
titles = re.findall(pattern,html)
print(titles)
html object gets html code from a specific url.
html = response.read()
I get the error "Can't use string pattern on a byte-like object". I have tried using:
regex = b'<title>(.+?)</title>'
but that appends a "b" to my results? Thanks.