将子列表插入列表 n python

Inserting a sub list into a list n python

我有一个列表 A=[[1,2],[2,3],[4,5]] 并且我想在列表 A 的索引 = 1 处插入 [2,2]。应该怎么做我做?我不应该为此使用任何包。最终数组将是:A=[[1,2],[2,2],[2,3],[4,5]] 我使用了以下代码,但出现错误:

A.insert([2,2],1)

您可以使用:

A.insert(1, [2, 2])

来自 docs:

list.insert(i, x)

Insert an item at a given position. The first argument is the index of the element before which to insert, so a.insert(0, x) inserts at the front of the list, and a.insert(len(a), x) is equivalent to a.append(x).