[python] fix a few of the python tools to be python 2 and 3 compatible
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
import sys, os, struct
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print "not enough args, usage:"
|
||||
print "%s <binfile>" % sys.argv[0]
|
||||
print ("not enough args, usage:")
|
||||
print ("%s <binfile>" % sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
f = open(sys.argv[1], "r+b")
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
import sys, os, array
|
||||
|
||||
if len(sys.argv) < 3:
|
||||
print "not enough args, usage:"
|
||||
print "%s <binfile> <outfile>" % sys.argv[0]
|
||||
print ("not enough args, usage:")
|
||||
print ("%s <binfile> <outfile>" % sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
fin = open(sys.argv[1], "r+b")
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user