Using python to write hex to a file
I am trying to create a bunch of binaries containing the corresponding hex values
for i in range(2**8):
file = open("test" + str(i) + ".bin", "wb")
file.write(hex(i))
file.close()
Unfortunately, it looks like the textual representation of my counter converted to hex is being written to files instead of the actual hex values. Can someone fix this code? I'm pretty sure the problem is withhex(i)
+3
source to share