Use print() function in both Python 2 and Python 3

Legacy __print__ statements are syntax errors in Python 3 but __print()__ function works as expected in both Python 2 and Python 3.
This commit is contained in:
cclauss
2019-09-22 13:54:24 -04:00
committed by Daniel Agar
parent cdbe4a3ee8
commit c18104d48b
5 changed files with 53 additions and 48 deletions
@@ -1,5 +1,6 @@
from __future__ import print_function
import sys
print 'Arguments: file - ' + sys.argv[1] + ', length - ' + sys.argv[2]
print('Arguments: file - ' + sys.argv[1] + ', length - ' + sys.argv[2])
file = open(sys.argv[1], 'w')
for i in range(int(sys.argv[2])):
b = bytearray([i & 0xFF])