I am currently experimenting with python-twitter along with the Twitter API, and am making a script that sounds the print "\a"
alarm when a user uploads a new tweet.
So far I have this function:
def tweets():
statuses = api.GetUserTimeline('username')
tweets = [s.text for s in statuses]
latest = tweets[0]
prev = tweets[1]
time.sleep(10)
print latest
It works so far as retrieving and printing the latest tweet every 10 seconds. However, how can I store the latest tweet from the last iteration of the loop (I have the function looping indefinitely) and compare it to the latest tweet in the current iteration? My idea is, that if these two are different, then print "\a"
will sound.