I'm trying to perform a regex substitution on a bytes variable but I receive the error
sequence item 0: expected a bytes-like object, str found
Here is a small code example to reproduce the problem with python3:
import re
try:
test = b'\x1babc\x07123'
test = re.sub(b"\x1b.*\x07", '', test)
print(test)
except Exception as e:
print(e)