Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Python tool to convert binary files to arrays of bytes (useful for loading into Arduino progmem)
from __future__ import with_statement
import sys
with open(sys.argv[1], "rb") as f:
b =
t = 0
while b:
sys.stdout.write("{0:#0{1}x}, ".format(ord(b), 4))
t += 1
if 8 == t :
t = 0
b =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.