Reputation: 773
So, say that I have a 2D list with these items:
foo = [[1,2,3][4,5,6]]
and I want to move foo[1][0] to foo[0][1] to make this output:
foo[1][0]
foo[0][1]
foo = [[1,4,2,3][5,6]]
How would I go about doing that?
Upvotes: 0
Views: 307
Reputation: 945
you can simply do this
foo[0].insert(1,foo[1].pop(0))
Upvotes: 1
Reputation: 4116
foo = [[1,2,3], [4,5,6]] foo[0].insert(1, foo[1].pop(0))