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

Function dump

recipes/Python/142812_Hex_dumper/recipe-142812.py:3–11  ·  view source on GitHub ↗
(src, length=8)

Source from the content-addressed store, hash-verified

1FILTER=''.join([(len(repr(chr(x)))==3) and chr(x) or '.' for x in range(256)])
2
3def dump(src, length=8):
4 N=0; result=''
5 while src:
6 s,src = src[:length],src[length:]
7 hexa = ' '.join(["%02X"%ord(x) for x in s])
8 s = s.translate(FILTER)
9 result += "%04X %-*s %s\n" % (N, length*3, hexa, s)
10 N+=length
11 return result
12
13s=("This 10 line function is just a sample of pyhton power "
14 "for string manipulations.\n"

Callers 3

recipe-142812.pyFile · 0.70
recipe-577418.jsFile · 0.50
ProcessMoveFunction · 0.50

Calls 2

joinMethod · 0.45
translateMethod · 0.45

Tested by

no test coverage detected