I am trying to create a file with all possible values for 0 up to 2^24 in HEX.
This is what I have so far:
file_name = "values.txt"
counter = 0
value = 0x0000000000
with open (file_name, 'w') as writer:
while counter < 16777216:
data_to_write = str(value) + '\n'
writer.write(data_to_write)
counter = counter + 1
value = value + 0x0000000001
This do what I want but with integers. Is there an easy way to turn this to HEX values in file instead (still as string)?
Thank you