我正在尝试创建一个字典,其中键是字符串,值是列表。类似的东西l1 = ['a', 'b', 'c']我想在 for 循环的每次迭代中添加类似于该列表的列表。我试过这个dicc['first'].append(l1)出口应该是这样的:dicc={'first': ['a', 'b', 'c']}我总是得到同样的错误: list indices must be integers or slices, not str我该怎么做?
添加回答
举报
0/150
提交
取消