||
import numpy
import random
import gzip
rr = numpy.array([int(random.random() * 10) for i in range(10000000)]).reshape(2000, 5000)
# npz
numpy.savez('rrr',mingzi = rr)
# write
with gzip.open('rrr_int.gz', 'wb')as f:
numpy.savetxt(f, rr)
# read
with gzip.open('rrr_int.gz', 'rb')as f:
n_rr = numpy.loadtxt(f)
print(numpy.array_equal(rr, n_rr))
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-7-28 02:17
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社