Mar-16-2020, 01:41 PM
(Mar-16-2020, 12:04 PM)scidam Wrote: You can use regular expression for this, e.g.
import re with open('1.bin', 'rb') as f: s = f.read() for match in s.finditer(b'\xFF\x00'): print(match.span())
thanks for help.
i got error with your code. "AttributeError: 'bytes' object has no attribute 'finditer'"
and i try with
import re with open('1.bin', 'rb') as f: s = f.read() for match in re.finditer(b'\xFF\x00'): print(match.span())got error"TypeError: finditer() missing 1 required positional argument: 'string'"