Writing some floats in a file in an efficient way

Peter Otten __peter__ at web.de
Wed Feb 21 09:33:11 EST 2018


ast wrote:

> Is there a way to write a float with only 8 bytes ?

If you want to write the values one-by-one convert them to bytes with 
struct.pack() and then write the result. 

To write many values at once use array.array.tofile() or 
numpy.array.tofile().




More information about the Python-list mailing list