I am generating some numbers(lets say, num) and writing the numbers to output file using outf.write(num). But compiler is throwing an error:
outf.write(num).
i = Your_int_value
Write bytes value like this for example:
the_file.write(i.to_bytes(2,"little"))
Depend of you int value size and the bit order your prefer