[python-win32] print file byte contents distribution

2011-03-04 Thread Ghostly
Hi, As I don't see any CLI tool other then hex editor, I thought on writing small script that will display byte distribution from file content So I thought on this: - counter = {} for bytes in open('c:\\temp\\bin.dat', rb).read(): counter[bytes] =

Re: [python-win32] print file byte contents distribution

2011-03-04 Thread Ghostly
Thanks guys for your input As I need this for larger files (couple of tens even hundrets of MB) I tested your suggestion and it seems that dict method is fastest. I ended with this: import sys try: counter = {} for bytes in open(sys.argv[1], rb).read():