I'm new to Python, Twitter, and Tweepy. I managed to pull data from Twitter, but I now want to store it into a CSV file.
My code is:
#!/usr/bin/python
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 prints data out on CLI, but I want it to output to a CSV file. I tried a few different options, but it only outputted the first tweet and not all tweets.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…