So I have a list of about 300 Tweets captured using Tweepy. Many of these Tweets are Retweets which I want to remove from the list. These can be identified easily as they start with "RT @".
My problem is despite what method I try some of these tweets manage to still get through my loop without being removed. I've tried a few variations of what you see below including the "startswith" function and the "in" operator that I've done below.
Can you see what I'm doing wrong?
def CleanData(tweets):
removed_tweets = []
for tweet in tweets:
if ("RT @") in tweet.full_text:
tweets.remove(tweet)
removed_tweets.append(tweet)
return tweets