I am new to Python, Twitter and Tweepy. I managed to get the data from Twitter, but now I want to save it in a CSV file.
My code is:
import tweepy
auth = tweepy.auth.OAuthHandler('XXXXXX', 'XXXXXXX'
auth.set_access_token('XXX-XXX', 'XXX'
api = tweepy.API(auth)
for tweet in tweepy.Cursor(api.search,
q="google",
since="2014-02-14",
until="2014-02-15",
lang="en").items():
print tweet.created_at, tweet.text
This outputs the data to the CLI, but I want it to be output to a CSV file. I tried several different options, but it only displayed the first tweet and not all tweets.
source
share