[python-win32] print file byte contents distribution

Tim Roberts timr at probo.com
Fri Mar 4 22:46:56 CET 2011


Ghostly wrote:
> 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 decided to find out, so I ran "timeit" on both schemes using a 2MB
file.  The two methods are within 1% of each other -- sometimes the dict
is slightly faster, sometimes the list is slightly faster.  Thus, for
all practical purposes, they are identical.  I'm surprised.  That means
you should use the one that makes sense to you.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list