This looks like a really slow way to go about solving this problem. A better approach, assuming these are bytes (it looks like they are) would be to use byte strings and the re
module. For instance, you might write
re.sub(r'[\x7e\x7d\x11\x13]', b'\x7d\\1', frameData)