I have a python array which contains multiple arrays with sentences, each sentence having a certain amount of elements (words).
Example:
[
['im', '23/f', '.'],
['want', 'back', '.'],
['one', 'got', 'altogether', '.'],
['used', 'multitask', 'before', '.'],
['excellent', '.'],
['people', 'pleaser', ',', 'really', 'see', 'expectations', '.'],
['also', 'perfect', 'daughter', 'good', 'grades', '.'],
['responsible', '.'],
['enthusiastic', 'dreamed', 'big', '.'],
['im', '..', 'fat', 'tired', 'time', '.'],
['find', 'everything', 'tiring', '.'],
['studying', 'seems', 'pointless', '.'],
['want', 'something', 'new', 'time', ',', 'anxiety', '.'],
['wan', 'na', 'brave', 'independent', 'time', ',', 'find', 'comfort', 'depending', 'people', '.'],
['know', ',', 'suck', '.'],
['stuck', '.'],
['know', 'story', 'leads', '.'],
['know', 'me', '.'],
['seems', 'like', 'dont', 'life', 'eyes', 'anymore', '.']
]
I want to remove all the characters like "full stops" or "question marks" etc.
I wrote this simple for loop to do so, but it only removes most, but not all "full stops".
for sentence in body:
for word in sentence:
if len(word) < 3:
sentence.remove(word)
How can it not remove all words that have fewer than 3 characters but only some?