How to append multiple parts of a tweet to a string?

python
tweepy

#1

I have a script to stream in tweets in to a csv file and it works as i intended. However I have only managed to split the data between the text object of a tweet and the rest of the object, passing the text object into the string and then writing that to the csv file. However I would like to be able to append the location, co-ordinate, retweet_count, created_at to the string as well as be able to pull the location data from the user object.

This part of my code splits the streamed data and places the text object in the string:

tweet = data.split(’,“text”:"’)[1].split(’","source’)[0]
saveMe = tweet+’::’+’\n’
output.write(saveMe)

This above codes snippet works and appends a tweet like so:

Owen Smith says Labour ‘needs to highlight Brexit risks’: Sacked Owen Smith says he \u201cstood\u2026 https://t.co/KDDSJd4bdj::

However when i try change the snippet to try append other objects:

tweet = data.split(’,“text”:"’)[1].split(’",“source’)[0]
location = data.split(’,“location”:”’)[1].split(’","source’)[0]
saveMe = tweet+’::’+location+’\n’
output.write(saveMe)

I get an error

list index out of range

How would i be able to change this code to best append multiple twitter objects to the same string?