这是我原来的数组:
b = [[], [1], [22, 132], [3, 123], [], [], [6], [], [], [89]]
这就是我想要的:
b = [[], [], [], [], [], [], [], [], [], []]
答案 0 :(得分:1)
您需要遍历b
,将每个元素设置为空列表或删除该元素的内容:
for i in xrange(len(b)):
b[i] = []
或
for i in xrange(len(b)):
del b[i][:]