我有一张单子
listoflist = [[['I', 'nvestment activity during the year is summarised as fol', 'l', 'ows:'],
['InterFace-Light', 'InterFace-Light', 'InterFace-Light', 'InterFace-Light'],
[[9.0], [9.0], [9.0], [9.0]]],
[(45.40929412841797, 167.94473266601562, 49.90929412841797, 178.0337371826172),
(47.360496520996094, 167.94473266601562, 241.59832763671875, 178.0337371826172),
(238.8065185546875, 167.94473266601562, 243.3065185546875, 178.0337371826172),
(240.51470947265625, 167.94473266601562, 259.0223083496094, 178.0337371826172)]]
[[['Cost'],
['InterFace-Bold'],
[[9.0]]],
[(526.6923828125, 189.15679931640625, 544.8453979492188, 199.52481079101562)]]
[[['Additions', '£’', '000'], ['InterFace-Bold', 'InterFace-Bold', 'InterFace-Bold'],
[[9.0], [9.0], [9.0]]],
[(56.747901916503906, 199.1571044921875, 95.19589233398438, 209.52511596679688),
(523.3358154296875, 199.1571044921875, 532.69580078125, 209.52511596679688),
(530.2658081054688, 199.1571044921875, 544.8457641601562, 209.52511596679688)]]]
我想用['Investment activity during the year is summarised as follows:'], ['Cost'], ['Additions', '£’000']
替换listoflist[0][0][0]
这是我目前的代码:
new_list = [['Investment activity during the year is summarised as follows:'],
['Cost'],
['Additions', '£’000']]
for i in listoflist:
i[0].pop(0)
for ii in new_list:
i[0].insert(0, ii)
根据您要执行的操作(替换或插入),这里有两个选项:
插入:
要替换:
编辑:
替换:
插入:
我想我终于明白你想做什么了:
相关问题 更多 >
编程相关推荐