from array import array
from random import random
from os import remove

size = 10**5
floats = array('d', (random() for i in range(size)))
print(floats[-1])

fp = open('floats.bin', 'wb')
floats.tofile(fp)
fp.close()

floats2 = array('d')
fp = open('floats.bin', 'rb')
floats2.fromfile(fp, size)
fp.close()

print(floats2[-1])
assert (floats2 == floats)

remove('floats.bin')

42cbd6482450cdf4dae079bd2d31d7d022a55817
<mask token>

<mask token>
print(floats[-1])
<mask token>
floats.tofile(fp)
fp.close()
<mask token>
floats2.fromfile(fp, size)
fp.close()
print(floats2[-1])
assert floats2 == floats
remove('floats.bin')

<mask token>
size = 10 ** 5
floats = array('d', (random() for i in range(size)))
print(floats[-1])
fp = open('floats.bin', 'wb')
floats.tofile(fp)
fp.close()
floats2 = array('d')
fp = open('floats.bin', 'rb')
floats2.fromfile(fp, size)
fp.close()
print(floats2[-1])
assert floats2 == floats
remove('floats.bin')

from array import array
from random import random
from os import remove
size = 10 ** 5
floats = array('d', (random() for i in range(size)))
print(floats[-1])
fp = open('floats.bin', 'wb')
floats.tofile(fp)
fp.close()
floats2 = array('d')
fp = open('floats.bin', 'rb')
floats2.fromfile(fp, size)
fp.close()
print(floats2[-1])
assert floats2 == floats
remove('floats.bin')

from array import array
from random import random
from os import remove

size = 10**5
floats = array('d', (random() for i in range(size)))
print(floats[-1])

fp = open('floats.bin', 'wb')
floats.tofile(fp)
fp.close()

floats2 = array('d')
fp = open('floats.bin', 'rb')
floats2.fromfile(fp, size)
fp.close()

print(floats2[-1])
assert (floats2 == floats)

remove('floats.bin')
