"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
> f = open("filename", "rb")
> s = f.read()
> sub = "\x00\x00\x01\x00"
> count = s.count(sub)
> print count
That's a lot of lines. This is a bit off topic, but I just can't stand
unnecessary local variables.
print file("filename", "rb").read().count("\x00\x00\x01\x00")
--
Björn Lindström <[EMAIL PROTECTED]>
Student of computational linguistics, Uppsala University, Sweden
--
http://mail.python.org/mailman/listinfo/python-list
