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)

 



posted @ 2019-07-22 16:23  tangjunjun  阅读(518)  评论(0编辑  收藏  举报
https://rpc.cnblogs.com/metaweblog/tangjunjun