1 2 3 4 5
import sys f = open(sys.argv[1], 'rb').read() f = map(lambda x:'0x%02x' % ord(x), f) f = ','.join(f) open(sys.argv[1] + '.txt', 'w').write(f)