Apr-14-2018, 02:09 PM
I'm trying to do one of two things:
1- .append() to a 2d array.
OR
2- have multiple arrays, e.g. array1, array2, then use array+intvar.append()
I have tried defining my array (list) with
I have tried appending to
I have also tried:
Ideally, solution 1 would be better than solution 2, because I don't need to manually create X arrays. However, I would like an explanation for both methods.
Thank you in advance.
1- .append() to a 2d array.
OR
2- have multiple arrays, e.g. array1, array2, then use array+intvar.append()
I have tried defining my array (list) with
array = [][]
and array = [[]]
.I have tried appending to
array[1].append("test")
.I have also tried:
array1 = [] intvar = 1 exec("array"+str(intvar)).append("test"))Error:
AttributeError: 'NoneType' object has no attribute 'append'
Ideally, solution 1 would be better than solution 2, because I don't need to manually create X arrays. However, I would like an explanation for both methods.
Thank you in advance.