bytearray与矩阵转换对应关系
import numpy as np
import os
a=bytearray(os.urandom(27))
# for i in range(21):
# print(a[i])
a=np.array(a)
print(a)
b=a.reshape((-1,3))
print(b)
c=bytearray(b)
print(c)
for i in range(27):
print(a[i])
import numpy as np
import os
a=bytearray(os.urandom(27))
# for i in range(21):
# print(a[i])
a=np.array(a)
print(a)
b=a.reshape((3,3,3))
print(b)
print(b[0,:,:])
c=bytearray(b)
print(c)