I'm using Python 3 and I want to be able to write hex to a file like this but i cannot get it to work. This gives me a TypeError and if encode it the output to the file isn't correct.
junk = '\x90' * 5junk += '\xcc' * 5fo = open("foo.list", "wb")fo.write(junk)fo.close()
this gives me a type error, str doesn't support the buffer interface
, if i however do this
junk = '01BDF23A'junk += '90' * 5junk += 'cc' * 5fo = open("foo3.m3u", "wb")fo.write(binascii.unhexlify(junk))fo.close()
it works but i would like to define them as hex (\x90), any ideas?
Thanks in advance for any help!