I'm attempting to append these two arrays as they're built but am getting unexpected results in Python:
This = []
That = []
This.append('A')
That.append(This)
This.append('B')
That.append(This)
print(That)
Expected results: [['A'],['A','B']]
Actual results: [['A','B'],['A','B']]
Whereas this works as expected:
That = []
This = ['A']
That.append(This)
This2 = ['A', 'B']
That.append(This2)
print(That)
Expected results: [['A'],['A','B']]
Actual results: [['A'],['A','B']]
This
twice, that's what you get inThat
.print(This)
. This will revealThis=['A','B']
.