ZMY wrote:
> Dear Robert,
>
> So how should I do this? I tried
>
> d1 = {1: array([2, 3, 4]).copy(), 2: ''}
> l1 = []
> for i in range(3): l1.append(d1.copy())
>
> and it still doesn't work.
Of course it doesn't, for the same reason that your first attempt didn't work
either. You've
Dear Robert,
So how should I do this? I tried
d1 = {1: array([2, 3, 4]).copy(), 2: ''}
l1 = []
for i in range(3): l1.append(d1.copy())
and it still doesn't work.
I think my problem is: how to create a new array every time I append
it to the list...
Thanks in advance,
- ZMY
On
ZMY wrote:
> I am new to Numpy/Pylab, and I am trying to construct a list of
> dictionaries with arrays as the items, for example:
>
dict = {1: array([2, 3, 4]), 2: ''}
list1 = []
for i in range(3): list1.append(dict.copy())
> ...
list1
> [{1: array([2, 3, 4]), 2: ''}, {1: arra