Simply don't convert numbers to text.
It's really as simple as that.
Don't use text files.
Simply store the data as-is. You've got the samples in RAM as consecutive 16-bit signed integers? Store that buffer. As 64bit double-precision floating point? Store that buffer.
It's really simple. Every programming language has a
write, whatever, call to save raw data from RAM into a file. Just don't convert the data to text in between.
Simply don't use a text file to store anything that isn't text. By the way, saving floating point numbers as decimal numbers in text files is just setting yourself up for rounding errors, where you get different results when you read the data from a intermediate save file and when you directly process them.
For an example where this is used, see the GNU Radio FAQ. GNU Radio is a software defined radio framework, and hence, we've often got to deal with laaaaaarge numbers of samples. It also gives an example of how to read the files from Python (it's really just
numpy.fromfile, nothing magical).