I have this list
[[\'a\', \'a\', \'a\', \'a\'],
[\'b\', \'b\', \'b\', \'b\', \'b\'],
[\'c\', \'c\', \'c\', \'c\', \'c\']]
and I want to conca
When you call
enumerate(list_of_lines, start=1)
, the pairs that it generates are not
1 ['b', 'b', 'b', 'b', 'b']
2 ['c', 'c', 'c', 'c', 'c']
, but rather
1 ['a', 'a', 'a', 'a']
2 ['b', 'b', 'b', 'b', 'b']
3 ['c', 'c', 'c', 'c', 'c']
That is, the start value indicates what the first index used should be, not what the first element to use is.
Perhaps an alternate way of doing this would be as follows:
for (index, item) in list(enumerate(list_of_lines))[1:]:
list_of_lines[index][1:3] = [''.join(item[1:3])]