HexEdit/HexEditWidget.py

changeset 4664
a40706f44514
parent 4663
e2625053a0e2
child 4669
d37bfc9ca3b9
equal deleted inserted replaced
4663:e2625053a0e2 4664:a40706f44514
1620 ascStr = "" 1620 ascStr = ""
1621 for j in range(16): 1621 for j in range(16):
1622 if (i + j) < len(byteArray): 1622 if (i + j) < len(byteArray):
1623 hexStr += " {0:02x}".format(byteArray[i + j]) 1623 hexStr += " {0:02x}".format(byteArray[i + j])
1624 by = byteArray[i + j] 1624 by = byteArray[i + j]
1625 if by < 0x20 or by > 0x7e: 1625 if is_Py2 and (by < 0x20 or by > 0x7e):
1626 ch = "."
1627 elif not is_Py2 and \
1628 (by < 0x20 or (by > 0x7e and by < 0xa0)):
1626 ch = "." 1629 ch = "."
1627 else: 1630 else:
1628 ch = chr(by) 1631 ch = chr(by)
1629 ascStr += ch 1632 ascStr += ch
1630 result += "{0} {1:<48} {2:<17}\n".format(addrStr, hexStr, ascStr) 1633 result += "{0} {1:<48} {2:<17}\n".format(addrStr, hexStr, ascStr)

eric ide

mercurial