Use byte literal as a pattern:
title = re.findall(b'<title>(.*)</title>', htmltext)
or decode the received data into a string:
title = re.findall('<title>(.*)</title>', htmltext.decode('utf-8'))
(change utf-8with the appropriate encoding of the document)
source
share