Is it possible to save and access array or list containing elements with different length? For instance, I want to save data=[s,r,a,se]
r,a are scalar but s
and se
are an arrays with 4 elements.(in python language)
For instance in one time:(s,r,a,se)
are different in different times
s=[1,3,4,6] r=5 a=7 se=[11,12,13,14]
data=[s,r,a,se]=[[1,3,4,6],5,7,[11,12,13,14]]
How I can define the array containing them to be able to call them similar to the following code:
s=[data[0] for data in minibatch]
r=[data[1] for data in minibatch]
a=[data[2] for data in minibatch]
se=[data[3] for data in minibatch]
Also, how I can extract (Find) that is there a special[stest,rtest,atest,setest]
in data
(stest,setest
are with 4 elements)
For instance: I want to see can I find [[1,2,3,4],5,6,[7,8,9,10]]
in data which is something similar to: [ [[1,2,3,4],5,6,[7,8,9,10]] ,[[...,...,...,...],...,..., [...,...,...,...]], [[18,20,31,42],53,666,[27,48,91,120]]]
If I did not find I append to it otherwise nothing is happened!
You can add them in a new list:
new_list = [s, r, a, se]
But you'll have to be careful managing this list