I am having trouble understanding why my code is failing to work. I am trying to remove words from a list that are only one character in length:
line = ['word','a','b','c','d','e','f','g'] for words in line: if len(words) == 1: line.remove(words) This code returns this (which looks to remove 'every other' single character):
>>> line ['word', 'b', 'd', 'f'] Can anyone explain why this isn't working properly and how to fix?