pythone memo int.from_bytesの使い方
#batch example
#cd /d %~dp0
#python bin2asc2.py %1
import sys
import pathlib
infile = sys.argv[1]
outfile = pathlib.PurePath(infile).stem + ".csv"
with open(infile, 'rb') as fr:
with open(outfile, 'w') as fw:
while True:
data = fr.read(1)
if data:
buf = int.from_bytes(data, byteorder='big')
fw.write ("0x%08x,%d\n" % (abc,buf))
else:
break