Below is the code I am trying to save the results I get from my print status to csv or json
# Creating the authentication object
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
# Setting your access token and secret
auth.set_access_token(access_token, access_token_secret)
# Creating the API object while passing in auth information
api = tweepy.API(auth)
# The Twitter user who we want to get tweets from
name = "mytwitterid"
# Number of tweets to pull
tweetCount = 10
for status in tweepy.Cursor(api.home_timeline).items(10):
# Process a single status
print(status.text)
#result = {}
with open('output.csv', 'w') as csvfile:
csvwriter = csv.writer(csvfile)
for row in status.text():
csvwriter.writerow(row)
This throws error for row in status.text(): TypeError: 'str' object is not callable
status.text(without the brackets) the way you use that a few lines above.status.textisstr. Just use it as it isstatus.text()in yourforloop, just usestatus.textstatusis local tofor status in ...therefore check your indentation and show the output ofprint(status.text). Second, the parameterrowmust be asequence, looping astrdoesn't result in asequence.