MCPcopy Create free account
hub / github.com/ActiveState/code / main

Function main

recipes/Python/456373_Map/recipe-456373.py:4–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import sys
3
4def main():
5 try:
6 table = [0] * 256
7 data = open(sys.argv[1], 'rb')
8 buff = data.read(2 ** 20)
9 while buff:
10 for c in buff:
11 table[ord(c)] += 1
12 buff = data.read(2 ** 20)
13 data.close()
14 sys.stdout.write(
15 '\n'.join('%02X = %d' % (i, c) for i, c in enumerate(table) if c))
16 except:
17 sys.stdout.write('Usage: %s <filename>' % os.path.basename(sys.argv[0]))
18
19if __name__ == '__main__':
20 main()

Callers 1

recipe-456373.pyFile · 0.70

Calls 6

openFunction · 0.50
enumerateFunction · 0.50
readMethod · 0.45
closeMethod · 0.45
writeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected