You can add all the elements from a text file to the list:
list = [] f.open('textdocument'.txt) for elm in f (or text document, I\'m too tired): list.append(elm)
And as soon as you have all the elements in the list, run a for loop, which checks each element length, and if it is more than three, it returns the first top-level element
new_list = [] for items in list: if len(item) > 3: item.title() (might wanna check if this works in this case) new_list.append(item) else: new_list.append(item)
And look, does it work?
source share