I have a numpy.ndarray
sample of numbers, each between 1 and 2**20
.
I\'d like to write it into a binary file, such that each element is rep
Open the file in binary mode:
outputFile = open('testDS', 'wb')
Otherwise, the file object may do some magic translation of newline characters that show up in your binary data, resulting in additional characters being written to the file. See, for example, https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files