Thank you for your tutorial! Its was easy to follow and everything work on my first attempt!
I do not want to reload all the tweets from the web, while I am developing. I altered the first few lines, to cache the tweets locally.
save = "saved.pickle"
if os.path.exists(os.path.join(os.path.dirname(__file__), save)):
with open(save, 'rb') as f:
tweets = pickle.load(f)
else:
extractor = twitter_setup()
tweets = extractor.user_timeline(screen_name="realDonaldTrump", count=200)
with open(save, 'wb') as f:
pickle.dump(tweets, f)
What I did at the end (in my personal case) was to save the tweet list as a csv file (data.to_csv(...)), taking as an advantage that I already had all the info in a pandas dataframe. :)
Thanks for your great comment!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank you for your tutorial! Its was easy to follow and everything work on my first attempt!
I do not want to reload all the tweets from the web, while I am developing. I altered the first few lines, to cache the tweets locally.
Excellent idea!
What I did at the end (in my personal case) was to save the tweet list as a csv file (
data.to_csv(...)
), taking as an advantage that I already had all the info in a pandas dataframe. :)Thanks for your great comment!