[python] fix a few of the python tools to be python 2 and 3 compatible

This commit is contained in:
Travis Geiselbrecht
2020-02-20 01:22:31 -08:00
parent b54f5f2b0f
commit e0cdfbae17
3 changed files with 10 additions and 10 deletions

View File

@@ -13,18 +13,18 @@ parser.add_option("-a", "--after", dest="after", action="append",
if options.before and len(options.before) > 0:
for b in options.before:
print b
print (b)
offset = 0
f = bytearray(sys.stdin.read())
f = bytearray(sys.stdin.read(), 'utf-8')
for c in f:
if offset != 0 and offset % 16 == 0:
print ""
print "%#04x," % c,
print ("")
sys.stdout.write("%#04x," % c)
offset = offset + 1
print ""
print ("")
if options.after and len(options.after) > 0:
for a in options.after:
print a
print (a)