What a nifty script! I love it!
Here's my version. I tested using a 800 KByte image file and it runs
in a blink. Dictionary access in Python is very fast.
<code>
counter = {}
for bytes in open('c:\\temp\\16.jpg', "rb").read():
try:
counter[bytes] += 1
except KeyError:
counter[bytes] = 1
for key in sorted(counter.keys()):
print '%s: %d,' % (repr(key),counter[key]),
print
</code>
--
Vernon
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32