1

[[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], **2**, # <-- HERE [1, 2, 3], [1, 2, 3], [1, 2, 3]]

Here is my current output. If you look at the line above, there is a 2 by itself.
This is the code I used

                    someList.insert((index), 2)

Is there any way to have that 2 be inside the previous index for ex

[[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3, 2], # <-- HERE [1, 2, 3], [1, 2, 3], [1, 2, 3]]

Michał
  • 2,456
  • 4
  • 26
  • 33
somebody
  • 85
  • 3
  • 10
  • possible duplicate of [Append item to a specified list in a list of lists (Python)](http://stackoverflow.com/questions/15511867/append-item-to-a-specified-list-in-a-list-of-lists-python) – anon582847382 Mar 21 '14 at 22:51

1 Answers1

5

Erm...

someList[index].append(2)
Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358