Scanning a file

Kent Johnson kent37 at tds.net
Fri Oct 28 20:53:22 CEST 2005


pinkfloydhomer at gmail.com wrote:
> I want to scan a file byte for byte for occurences of the the four byte
> pattern 0x00000100. 

data = sys.stdin.read()
print data.count('\x00\x00\x01\x00')

Kent



More information about the Python-list mailing list