I have a list of numbers I'm trying to write to a file, which I want to be a binary file.
Here's my code:
nums = [0x1234, 0x5678, 0xabcd, 63, 44] with open('filename', 'wb') as bin_file: for number in nums: bin_file.write(number)
The problem is that I keep getting an empty file, as if nothing is actually written to it.
Can someone please tell what am I missing here?
Thanks a lot :-)