为什么使用此代码:
result_list = [[]]*14
result_list[3].append('sdfda')
print(result_list)
输出:
[['sdfda'], ['sdfda'], ['sdfda'], ['sdfda'], ['sdfda'], ['sdfda'], ['sdfda'], ['sdfda'], ['sdfda'], ['sdfda'], ['sdfda'], ['sdfda'], ['sdfda'], ['sdfda']]
但我希望:
[[], [], [], ['sdfda'], [], [], [], [], [], [], [], [], [], []]
我想按索引插入元素...但是此示例代码在列表的所有列表中插入元素