Get string from a tweet mentioning a specific user with Twython

171 views Asked by At

I want to make a bot that, upon someone mentioning it (@username) in the tweet, it receives all the text from the tweet and looks for 'on' or 'On' or 'off' or 'Off'. I've setup Twython and have it working and I know how to do everything here except recieve the text from a tweet.

TL;DR I want to get text from a tweet with Twython, and I don't know how, please help

1

There are 1 answers

0
LonelySoul On

If you already have the list of tweets then following might help you.

import re
list = ['This is @brent','This is @alex']
test = re.compile["@alex",re.IGNORECASE)
files = [f for f in list if test.search(f)]
print files