count = 0
i = 0
while count < len(mylist):
newlist.append(mylist[i + 1])
newlist.append(mylist[i + 2])
# ...
count = count + 1
i = i + 12
I wanted to make the newlist.append() statements into a few statements.
No. The method for appending an entire sequence is list.extend().
>>> L = [1, 2]
>>> L.extend((3, 4, 5))
>>> L
[1, 2, 3, 4, 5]
list.extend() must be an iterable.
[]instead of(). Please post real working code.