亲爱的,
我想在 python 中执行以下操作,但没有找到关于如何从数据生成data_rejuggled的参考资料(matlab 除外):
from collections import namedtuple
data=[1,2,2,2,3,4,5,5,5,5]
dims=[1,3,1,1,4]
data_rejuggled=somefunction(data,dims) #<--THIS is what I want to know
print data_rejuggled
[1,[2,2,2],3,4,[5,5,5,5]]
names=["a","b","c","d","e"]
recID ='r'+str(1) #define a rec id
s = namedtuple(recID, names, verbose=False) #create tuple
s=s(*data_rejuggled) #fill tuple
print s
r1(a=1, b=[2, 2, 2], c=3, d=4, e=[5, 5, 5, 5])
背景:
- 数据从二进制文件中解码
- 数据可能非常大
感谢您的阅读,
F#