官术网_书友最值得收藏!

Collecting the tweets

We will start by using the Twython library to access the Twitter API and collect a series of tweets, labeling them with the originating political party.

The details of the implementation can be found in our GitHub repository in the following Jupyter Notebook: 

 chapter2/collect_tweets.ipynb 

We need to invoke the following method in the Twython library to save tweets from @GOP and @TheDemocrats into two text files, gop.txt and dems.txt:

twitter.get_user_timeline(screen_name='GOP', tweet_mode='extended', count=500)

Each file contains 200 tweets. The following are some excerpts from the dems.txt file:

  • This cannot be who we are as a country. We need to find out what happened and ensure it never happens again.
  • RT @AFLCIO: Scott Walker. Forever a national disgrace.
主站蜘蛛池模板: 高清| 曲麻莱县| 剑阁县| 方山县| 崇州市| 永城市| 荥阳市| 锡林郭勒盟| 象山县| 陵川县| 禄劝| 蕉岭县| 泸西县| 宜城市| 镇宁| 瑞安市| 阳春市| 安平县| 临武县| 潼关县| 秦皇岛市| 东平县| 武清区| 鹰潭市| 宁明县| 曲松县| 固原市| 澜沧| 潞西市| 澄江县| 嘉义市| 景东| 日土县| 图片| 金华市| 无极县| 探索| 安康市| 丰都县| 利津县| 富锦市|