I have a file which mixes binary data and text data. I want to parse it through a regular expression, but I get this error:
TypeError: can't use a string pattern on a bytes-like object
re.compile you need to use a
bytes object, signified by an initial
r = re.compile(b"(This)")
This is Python 3 being picky about the difference between strings and bytes.