Writing hex data into a file,f.write(hex(i))