31 lines
543 B
Python
31 lines
543 B
Python
from sys import argv, exit as exitc
|
|
|
|
if len(argv) > 2:
|
|
print('Please inform just one file!')
|
|
exitc(2)
|
|
|
|
elif len(argv) != 2:
|
|
print('Plase inform a file!')
|
|
exitc(3)
|
|
|
|
try:
|
|
file = open(argv[1], 'rb')
|
|
|
|
except FileNotFoundError:
|
|
print('The specified file was not found!')
|
|
exitc(4)
|
|
|
|
content = file.read()
|
|
file.close()
|
|
|
|
for i in range(len(content)):
|
|
if i%12 == 0:
|
|
print('')
|
|
|
|
print(format(content[i], '#04x'), end='')
|
|
|
|
if i != len(content)-1:
|
|
print(', ', end='')
|
|
|
|
print('\nSize:', len(content))
|